u can use whatever one you use and just save it as LabPart6.sql could you do the
ID: 3727847 • Letter: U
Question
u can use whatever one you use and just save it as LabPart6.sql could you do the work and i plug the info in myself
Write original seven queries using the database you created for Lab Part 5. Write one demonstrating your understanding of aggregate functions and set operators: AVE, CUBE ROLLUP, GROUPING, UNION, INTERSECT and MINUS.
For each query, write a question that the return set of the query answers in the space below. Place the sql for each query in a file named LabPart6.sql. Include a description of the query in the file.
Query 1
The query contains a subquery because a SELECT statement is coded within another SQL statement. The subquery is coded in the WHERE clause of the SELECT statement.
The query answers the question: What returned orders have reason “Product Damaged”?
Query 2
The query contains a subquery because a SELECT statement is coded within another SQL statement. The subquery is coded in the WHERE clause of the SELECT statement.
The query answers the question: What subquery orders have reason “subquery ID”?
Query 3
The query contains a subquery because a SELECT statement is coded within another SQL statement. The subquery is coded in the WHERE clause of the SELECT statement.
The query answers the question: What returned orders have reason “number of IDs”?
Query 4
The query contains a join because a SELECT statement is coded within another SQL statement. The join is coded in the join clause of the SELECT statement.
The query answers the question: What from orders the “order ID”?
Query 5
The query contains a subquery because a SELECT statement is coded within another SQL statement. The subquery is coded in the join clause of the SELECT statement.
The query answers the question: What from orders have reason “order ID”?
Query 6
The query contains a distinct because a SELECT statement is coded within another SQL statement. The distinct is coded in the WHERE clause of the SELECT statement.
The query answers the question: What from to date orders have reason “2016”?
2016 is greater than the selected distinct
Query 7
Only those clients who have not order any product whose Name %Product%. The c_no column for the outer query table, customer, have relation to c_no column for the c_order table for the sub query.
Explanation / Answer
1. SELECT returnedorders from Orders
where returnedorders value IN ( SELECT reason from orders where reason = " Product Damaged").
2.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.