Question
1. Display the customer number, customer name, order number, and order date for each order. Sort the results by customer number. 2. Display the customer
2. Display the customer number, customer name, order number, and order date for all orders. Include all customers in the results. For customers that do not have orders, omit the order number and order date.
3. Create a view named TOYS that consists of the item number, description, units on hand, and unit price of each item in category TOY.
4. List customer number, customer name, rep name, rep number, and Number_Ordered.
5. List item_num, description, total_value (derive it by multiplying num_ordered and quoted_price for each line, and then take total with sum. You will need to join order_line and item tables and employ groups by the command in your query.
Note: We can add two types of variables on a SELECT statement. 1) Column_Names from tables, and if multiple tables are involved we use table_name.column_name to refer to them, e.g., PC.Emp_Number, 2) Column functions that may enclose column_names. Though Count(*) is also a column function without a column_name. Now the rules. When we display only column functions on a select statement, group by the statement is not needed. But, when we have a mix of regular columns and column functions, we must use group by, and we must group by all the columns that are not inside column functions. The group by command must list the regular columns in the same sequence as they appear on a select statement. It's better to first list the regular columns, and then the column functions on a select statement to minimize confusion.
Step by Step Solution
3.50 Rating (167 Votes )
There are 3 Steps involved in it
Step: 1
SQL Exercises Make a report with customer name city order number date and amount in ascending order ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started