Objectives• Write SQL statements.AssignmentDownload the file for this HW and submit a .sql file answering the following questions.RequirementsFirst setup the database. Go to the directory where you downloaded the file (where HW3-populate.sql is). Log in to mysql (hint: you may need to start up mysqld).show databases;create database HW3;show databases;use HW3;show tables;source HW3-populate.sqlshow tables;Create a text file named Firstname_Lastname_HW3.sql with your SQL statement answersfor the following as a working .sql file (can do: source Firstname_Lastname_HW3.sql):1. List all state names and their 2-letter codes.2. Write a query to report the information for all counties whose names start with“Prince”. (Hint: Use “like”).Output columns: name, statecode, populate_1950, population_2010Order by state code.3. Write a single query to list only the population in year 2010 for the staterepresented by Sen. Richard Lugar.Output column: populate_20104. Write a single query to report only the total number of the counties in ‘Maryland’.The query should not hard-code the state code for Maryland (join the two tables inthe WHERE clause)5. Write a single query to find the name of the state that was admitted last into theunion.Hint: Use nested subquery.6. Find all democratic (i.e., with affiliation = ‘D’) senators that are not chairman of anycommittee or sub-committee.Output columns: nameOrder by name.Submission1. Submit a .sql file named Firstname_Lastname_HW3.sql
CSCI3308
[Solved] CSCI 3308 Software Methods & Tools Assignment #3 SQL
30 $
File Name: CSCI_3308_Software_Methods_&_Tools_Assignment_#3_SQL.zip
File Size: 489.84 KB
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.