Using the ClassicModels database, answer the following questions. Download the h
ID: 3748704 • Letter: U
Question
Using the ClassicModels database, answer the following questions.
Download the http://www.mysqltutorial.org/mysql-sample-database.aspx
Provide the data that answers the question AND the SQL used to answer the question. Each query should include at least one join.
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’?
Explanation / Answer
1.
Select paymentDate from payments inner join customers on payments.customerNumber = customers.customerNumber where postalCode = '51003';
2.
Select employeeNumber from employees inner join offices on employees.officeCode = offices.officeCode where jobTitle = 'Sales Rep' and city = 'Tokyo';
3.
Select * from products,orderdetails where products.productCode != orderdetails.productCode;
4.
Select * from employees where reportsTo = 'Sales Rep';
5.
Select sum(quantityOrdered) from products inner join orderdetails on products.productCode = orderdetails.productCode inner join orders on orderdetails.orderNumber = orders.orderNumber where orderDate = '2004-01-29' and productLine = 'Vintage Cars';
Do ask if any doubt. Please upvote.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.