Jump to content

Hello. I know this is cheating, and not the right place, but this community hasn't failed me yet.

I have a SQL exam due really soon and I need help. It's an online course so reaching a professor for help wasn't exactly successful... table and column names are in Spanish, translated below.

I need the commands to answer this in this exact site (please don't edit the schema):

http://sqlfiddle.com/#!9/b1306d

The commands I need to use are:

CAPTION, GROUP BY, DISTINCT, HAVING, AND, OR, IN, BETWEEN, LIMIT, ALIAS, and other regular ones like SELECT, WHERE, COUNT, SUM, MAX, CONCAT, AVG, etc.

 

My remaining questions are:

 

1: Show all diverse car brands, without repeating them and the amount of cars in the table by brand, as "cantidad", grouped by brand in descending order, when the amount by brand is greater than 1

 

2: Show brand and the amount of different brands, as "total de marcas", when the brand is Honda, Mazda and the driver id is greater than 11, grouped by brand, in ascending order

 

3: Show everything about the cars, when the car id is lower than 26, ordered by car id in descending order, limiting the number of rows to 3

 

4: Show the name of the car along with its id in a single column, concatenated with a dash line in between, called "auto info", when the car name contains a Z or a T anywhere in the name, ordered by car id in descending order

 

5: Show the average model id of the car models, formatted to 4 decimals, named "promedio id modelos", when the model id is greater than 4 and lower than 26

 

Translated as best I could. Here are the table names and columns translated as well

Tables:

autos=cars

modelos=models

choferes=drivers

 

columns:

id_auto=car id

nombre=name

id_modelo=model id

marca=brand

id_chofer=driver id

num_chofer=driver number

apellido=last name

Link to comment
https://linustechtips.com/topic/700693-sql-help/
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×