Question

Assignment 2 Instructions You need to access to the database and write SQL queries on the...

Assignment 2 Instructions

You need to access to the database and write SQL queries on the following site:

https://www.w3schools.com/sql/trysql.asp?filename=trysql_op_in

1. Use INNER JOIN to create a report. In this report, list each customer’s CustomerID, CustomerName, and their each OrderID and each order’s OrderDate, if the customer has ever placed an order. You should use the Customers table and the Orders table in the database to complete this query.  

2. Use INNER JOIN to create a report. In this report, list each order’s OrderID, OrderDate, and each ProductID in each order. You should use the Orders table and the OrderDetails table in the database to complete this query.

3. Use OUTER JOIN to create a report. In this report, list the customer’s CustomerID and CustomerName if the customer has never placed an order. You should use the Customers table and the Orders table in the database to complete this task.

4. Use UNION to create a combined list to show SupplierID/ShipperID and SupplierName/ShipperName. You should use the Suppliers table and the Shippers table in the database to complete this query.

Please save the SQL query statements for each question into a Word document, and name the Word document as “MyAssignment2”. Please submit the document to myleo online before the deadline. Thank you!

Homework Answers

Answer #1

1.

Select Customers.CustomerID, CustomerName, OrderID, OrderDate from Customers inner join Orders on Customers.CustomerID = Orders.CustomerID;

2.

Select Orders.OrderID,OrderDate,ProductID from Orders inner join OrderDetails on Orders.OrderID = OrderDetails.OrderID;

3.

Select CustomerID, CustomerName from Customers Full Outer Join Orders on Customers.CustomerID = Orders.CustomerID where Customers.CustomerID IS NULL or Orders.CustomerID IS NULL;

4.

Select SupplierID, SupplierName from Suppliers UNION Select ShipperID,ShipperName from Shippers;

Do ask if any doubt. Please up-vote.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Using CIS495 sample database, write the SQL query: a. In the orderdetails table, list the unique...
Using CIS495 sample database, write the SQL query: a. In the orderdetails table, list the unique order which has more than 3 productCode in each order. b. List the customer name and address who purchase more than 5 items (ProductCode) in the order.  
Lab 5 Queries with Multiple Tables In this lab, we do queries more than one table....
Lab 5 Queries with Multiple Tables In this lab, we do queries more than one table. SQL provides two different techniques for querying data from multiple tables: • The SQL subquery • The SQL join As you will learn, although both work with multiple tables, they are used for slightly different purposes. We used WMCRM database which is what we created in Lab 4. Here is the summary of the database schema (where schema is used in its meaning of...
Write a SQL statement which joins the parts table with the supplier table and lists the...
Write a SQL statement which joins the parts table with the supplier table and lists the part_name, supplier_name for all parts in the part table. The supplier_id column in the suppliers table is the primary key in the suppliers table, and this key has been exported to the parts table where it is a foreign key. You should use an inner join for this query. Write a SQL statement which joins the parts table with the suppliers table and lists...
***This is a complete question. Do not tag this as incomplete. Write SQL queries to the...
***This is a complete question. Do not tag this as incomplete. Write SQL queries to the below Relational Database. • Regarding the SQL queries: • Do not use SELECT * in any query. • Do not use any SQL features (including Nullif) that were not covered in this course. • Do not use subqueries IF joins can be used to answer a question. However, some questions may require the use of subqueries. The Movie Database Notes: TheaterNum, MovieNum, and ActorNum...
Save your select statements as a script. Place the semicolon at the end of each SQL...
Save your select statements as a script. Place the semicolon at the end of each SQL statement. Please number your select statements from 1 to 8 in your script and comment out each number. Include your name and student number as a comment at the top of your script. The name of the script has to be Assignment1_JohnSmith. Instead of JohnSmith use your First Name and Last Name. Upload your script trough Blackboard. Use SQL Developer to create the My...
Question 1: Group by and Aggregates: Write SQL statements to answer the following questions using Assignment...
Question 1: Group by and Aggregates: Write SQL statements to answer the following questions using Assignment 4’s schema (Customer-Invoice-Line-Product-Vendor). Make sure that your SQL script runs without any errors. Submit your answers in a .SQL file. 1 (2 Points) - Find the count of distinctvendors thatsupplied products that are priced lowerthan 185? 2 (2 Points) - For each vendor, find their product that has the lowest product quantity. Your output should include vendor code, vendor name, product description and product...
PS8 JULY 1. Log on to your Oracle ApEx account. Navigate to SQL Workshop à SQL...
PS8 JULY 1. Log on to your Oracle ApEx account. Navigate to SQL Workshop à SQL Scripts Create a SQL script called update_demo_orders that contains these update statements: update demo_orders set order_total = 200 where customer_id = 1; update demo_orders set order_total = 15 where customer_id = 2; update demo_orders set order_total = 12 where customer_id = 3; update demo_orders set order_total = 22 where customer_id = 4; update demo_orders set order_total = 32 where customer_id = 5; update demo_orders...
The relational schema for the Academics database is as follows: DEPARTMENT(deptnum, descrip, instname, deptname, state, postcode)...
The relational schema for the Academics database is as follows: DEPARTMENT(deptnum, descrip, instname, deptname, state, postcode) ACADEMIC(acnum, deptnum*, famname, givename, initials, title) PAPER(panum, title) AUTHOR(panum*, acnum*) FIELD(fieldnum, id, title) INTEREST(fieldnum*, acnum*, descrip) Some notes on the Academics database: An academic department belongs to one institution (instname) and often has many academics. An academic only works for one department. Research papers (PAPER) are often authored by several academics, and of course an academic often writes several papers (AUTHOR). A research field...
Write a script to create the following tables with attributes as specified(SQL) Customer table with Customer’s...
Write a script to create the following tables with attributes as specified(SQL) Customer table with Customer’s id, name, address, city as varchar, customer’s date of birth as date type and zip code number where the customers id is the primary key in the table, name and date of birth are mandatory. Id has a 10-character limit, name, address and city have a 50-character limit, zip has a 5-character limit Product Table with Product id, description and finish as varchar, price...
SQL Write the queries necessary to obtain the required information 1) Use sub query and “in”...
SQL Write the queries necessary to obtain the required information 1) Use sub query and “in” keyword to print the salesreps (ids) who have taken order for the companies ‘Zetacorp’ or ‘JCP Inc.’ . Duplicate rows are not allowed 2) Use sub query to find the id and the name of every sales rep that represents at least one customer with a credit limit of greater than $5000. 3) Use sub query and keyword “exists” to list the id and...