Recent Question/Assignment
Assessment item 4 - Query databases using SQL
Value: 15%
Due Date: 30-Sep-2020
Return Date: 22-Oct-2020
Submission method options: Alternative submission method
TASK
Task: Complex SQL Queries
NOTES
• This assignment requires you to use SQL software to complete the tasks listed below.
• Optional acceptable software: MySQL, SQLite or Ms SQL server Xpress
• For guidance on how to install SQLite, watch this short YouTube video: https://www.youtube.com/watch?v=9ynCDVg54H0
• For guidance on how to create tables using SQLite, watch this short YouTube video: https://www.youtube.com/watch?v=kij5lPw0F-o
• Typing the SQL statements or the results is NOT acceptable.
Instructions
From Resources under Main Menu in Interact 2 go to Assignment 4 Folder
If you are using sqlite, copy sqlite3.exe file from the Assignment 4 Folder into a folder in your machine
Copy Ass4.txt from the Assignment 4 link into the folder in your machine where your SQLite file is located
From the SQLite Command Prompt execute the Ass4.txt script. To do this, at the SQLite Command Line type .read Ass4.txt [to create the tables you will use to answer this assignment’s questions]
At the SQLite Command Line type .headers on
At the SQLite Command Line type .mode column
Write and run SQL statements to complete the following tasks (Each Query : 1.5 (1 query
+ 0.5 for screenshot) Marks)
1. Show the details of the invoice who has the minimum and maximum subtotal.
2. Show the details of the invoices whose subtotal is greater than 25 but less than 75.
3. Using EXCEPT show the codes of the vendors who did not supply any products.
4. Show the details of the employees who are located in area code 615.
5. Show the details of the products that do not have a value for the attribute v_code.
6. Using inner join, list the details of the products whose line price is greater than 100.
7. List the names and codes of vendors and the number of products each vendor has supplied, i.e. vendor AAA has supplied xxx products, and vendor BBB has supplied yyy products etc.
8. List all purchases by customer 10011.
9. Using ‘NOT IN’ show the codes and names of the vendors who did not supply any products.
10. Show the codes and names of the vendors who supplied products.
You are required to submit:
1. The SQL statements for each query, which should be copied (as text) and pasted into your submission file.
(If you are using SQLite, you can type .echo on at the SQLite3 Command Line, SQLite will output your SQL statement with the results of the query making it easy to copy and paste both.)
2. The screenshots of the results of the SQL statements which are to be copied from your SQL query and pasted into your submission file immediately after you execute the SQL query.