sql test

Page 1

A small local take-out shop sells pizza, calzone, wings, and such. They have a simple database to track their customers and orders. The owner is not much of a SQL expert, so he asks you to answer some questions. Sample of the data You should assume that the tables are much larger than this when formulating the SQL. Table: Customer Customer_ID 1 2 3 4 5 6 ‌

Name Andy David Betty Charlie David Francine

Table: Purchase Customer_ID 1 6 3 2 5 5 3 6 2 ‌

Purchase_Date 1/11 1/12 1/12 1/13 1/13 1/15 1/18 1/24 2/12

Phone 415-555-1717 415-572-1414 415-655-1313 650-245-1515 650-892-1818 415-655-1212

Item Pizza Calzone Wings Calzone Calzone Wings Wings Pizza Wings

For each question please provide appropriate SQL to help the shop owner. Answer as many as you can. 1) The owner asks you for a list of all customers:

2) Now, all customers and their orders:


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.