Question

Customers ID Name Street City Zip email 1 Emily 101 Anza St San Francisco 94118 2...

Customers

ID

Name

Street

City

Zip

email

1

Emily

101 Anza St

San Francisco

94118

2

Amy

1 Houston Ave

New York

12111

3

John

29 Sunset Blvd

Los Angeles

45643

4

Pam

800 Market St

San Francisco

94080

5

Sue

400 Muir Ave

Redwood City

94598

6

Chris

987 A Ave

New York

13111

7

Todd

788 Harrison St

San Francisco

94117


Products

ID

Product_name

Price

Quantity

1

Metal pen

5.99

20

2

Surge protector

25.99

0

3

pencil

7.25

59

4

Replacement screen

75.25

54

5

PC monitor

200.5

6

6

Magic mouse

125.99

0

7

iphone charger

101.99

0

Given the data in the tables and the SQL query, what would the output look like? Write out the output from the SQL query

1. SELECT

Name

FROM customers

WHERE

City = 'San Francisco'

2. SELECT

C.ID,

C.name,

O.Delivery

FROM Customers C

Join Orders O

ON C.ID = O.Customers_ID

WHERE O.DELIVERY = "Shipping

Group by C.ID,

C.name

3. SELECT

Product_name

Count(*) as count_of_products

FROM products

WHERE

Price BETWEEN 2 and 100

GROUP BY

Product_name

4. SELECT

Product_name,

Price,

Count(*) as count_of_products

FROM products

WHERE

Quanity > 5

GROUP BY

Product_name, price

ORDER BY

Price ASC

Homework Answers

Answer #1

1)

SELECT

Name

FROM customers

WHERE

City = 'San Francisco'

output:

Name
Emily
Pam
Todd

2) Orders Table not provided

3)

SELECT

Product_name

Count(*) as count_of_products

FROM products

WHERE

Price BETWEEN 2 and 100

GROUP BY

Product_name

output:

Product_name count_of_products
Metal pen 1
Surge protector 1
Pencil 1
Replacement screen 1

4)

SELECT

Product_name,

Price,

Count(*) as count_of_products

FROM products

WHERE

Quanity > 5

GROUP BY

Product_name, price

ORDER BY

Price ASC

output:

Product_name Price count_of_products
Metal pen 5.99 1
pencil 7.25 1
Replacement screen 75.25 1
PC monitor 200.5 1

NB: For any doubts feel free to ask.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions