Question: Given the schema below write the SQL to answer the following questions. Each query should include at least one join. Table_Name : Column(s) customers :

Given the schema below write the SQL to answer the following questions. Each query should include at least one join.

Table_Name: Column(s)

customers: CustomerNumber, CustomerName, ContactLastName, ContactFirstName, phone, addressLines1, addressLines2, city, state, postalCode, Country, SalesRepEmployeeNumber.

employees: EmployeeNumber, LastName, FirstName, Extension, Email, OfficeCode, reportsTo, JobTitle.

offices: officeCode, City, phone, addressLine1, addressLine2, State, Country, postalCode, territory.

orderdetails: orderNumber, productCode, quantityOrdered, priceEach, OrderLineNumber.

orders: orderNumber, orderDate, requiredDate, ShippedDate, Status, Comments, CustomerNumber.

payments: CustomerNumber, CheckNumber, PaymentDate Amount.

productlines: productLine, TextDescription, htmlDescription, Image.

products: ProductCode, ProductName, ProductLine, ProductScale, ProductVender, productDescription, quantityInStock, BuyPrice, MSRP.

1. What Dates did Customers from postalCode 51003 make Payments?

2.What are the employeeNumbers for the employees that have the jobTitle of Sales Rep and work in Tokyo?

3. How many products were not ordered?

4.Who reports to a Sales Rep?

5.What is the total quantityOrdered for products ordered on 2004-01-29 for the productLine Vintage Cars?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!