Starting from:
$30

$24

Class Lab 2 Solution

Directions: This lab requires importing cars.csv and doing analysis on the data. For each question, write a corresponding SQL query to find the result




Turning In: Please submit a single .sql file with the answer to each question. You can do this in DBVis or in a text editor of your choice. Make sure your queries run correctly and produce the desired result. Comment the top of each query to specify what question it answers. Your turn in .sql file should be named firstname_lastname_lab2.sql. Comment at the top any references you use to help you with the lab.




Please follow the SQL Style Guide posted in the Content section on BB.




How many records are in the cars data?
How many cars originated in the US?
How many cars were built in years 70-75?
How many cars get more than 30 MPG?
Are there any cars with more horsepower than displacement? If so, what models?
How many car models have an MPG lower than 11?
Where were the cars from #6 built? (Hint: use a subquery)
Which car manufacturer origin has the lowest average HP?
How many cars made in the US have MPG under 20?
How much horsepower does a ford fiesta have?
Which number of cylinders has the highest average HP?
What countries have 4-cylinder cars?
How many cars that weigh under 2000 get an MPG lower than 30?
How many cylinders do the cars that get over 40 MPG have?
What countries did the cars in #13 originate in?
What is the percentage (out of all the data) of cars that originate in the US?
What is the percentage (out of all the data) of cars have 8 cylinders?
Write a query to return the average displacement per origin+cylinder combo. What is the result?
Write a query to only return the cylinders and average displacement, where the origin is Japan, from the query in #18. (Hint: use a subquery)
Find the model of the car that has the max HP in the US. (Hint: use a subquery)

More products