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
databases Write a SQL query that shows the OrderID, OrderDate, CustomerID, TotalAmount, ProductID, Quantity for orders...
databases Write a SQL query that shows the OrderID, OrderDate, CustomerID, TotalAmount, ProductID, Quantity for orders with a TotalAmount of 1000 and above. The results need to be sorted by TotalAmount in ascending order.
Assignment Instructions (MY WORK IN MYSQLBENCH)- Follow instructions in class to download and build a database...
Assignment Instructions (MY WORK IN MYSQLBENCH)- Follow instructions in class to download and build a database in your DBMS. Write and demonstrate queries (in-class) that do the following: Download the appropriate attached SQL file for your DBMS. Load the file into your database design tool and run it to build the Pine Valley Furniture Company database. This is the database that is used in the textbook examples for both Chapters 5 and 6. Write a query to show the price...
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.  
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...
Write the following SQL queries based on hbsoe database from Mode: Select all the employee information...
Write the following SQL queries based on hbsoe database from Mode: Select all the employee information and list them for first 100 only. Select all the order information from country Germany. How many distinct orders are made from each country? List the names of employees who made orders from country Germany. List the names of companies which supplies chai or tofu
***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...
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...
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...
Perform SQL queries in the given data structure. write an SQL query that gives the number...
Perform SQL queries in the given data structure. write an SQL query that gives the number of courses taken for every student in the student table. For each instructor, show the instructor name and the number of sections that have been taught by that instructor. You do not need to include instructors who have never taught a section. List in order of decreasing the number of sections taught. Give the number of semester/year combinations in which sections have been offered....
You have learned some database components such as entities (tables) with attributes (columns/fields) and keys in...
You have learned some database components such as entities (tables) with attributes (columns/fields) and keys in previous lessons such as Relational Databases, Database Fields and Field Specifications, and Establishing Keys. Now based on the examples in those lessons, you will design a database for CTU, which includes three entities (tables): Students, Faculty, and Classes. Note a class refers to a particular class section. For example, the current CS253 you are taking is one class instance (i.e. CS253-01), and another CS253...