NOTES:
In this assignment you have to use MySQL.
Assignment 5 tasks: each query is worth 5 marks
Write and run SQL statements to complete the following tasks
Part A - DML
1. Locate the record in the vendor table that does not have a value for the attribute V_STATE
2. Find the customers whose balance is greater than $300 but less than $400.
3. Show the names of the customers for whom we have invoices.
4. Show the CUS_CODE of the customers for whom we DO NOT have invoices.
5. Show the names of the customers for whom we DO NOT have invoices.
6. Find out how many times a customer generated an invoice – make sure the counted column heading reads “Invoices_generated”.
7. List the names of the customers and how many times a customer generated an invoice – make sure the counted column heading reads “N_Of_Invoices” .
Part B - DDL
1. Add a new row/record to the `customer` table to include your actual student_ID in the CUS_CODE, your last_name as the CUS_LNAME` and your firstname as CUS_FNAME. Add any other details of your choice in all the other fields.
2. Add a new attribute (field) credit_history VARCHAR(6) to the customer table.
3. Update credit_history for customer 10011 to Bad.
4. Delete the employee Leighla Genkazi from the EMP table.
5. Add a new attribute called ‘email_address’ to ‘emp’ table with data type and length ‘VARCHAR(20).
You are required to submit:
1. The SQL statements for each query, which should be copied from your SQLite3 Command Line and pasted into your submission file
2. The screenshots of the results of the SQL statements which are to be copied from your SQLite3 Command Line and pasted into your submission file immediately after you execute the SQL query. If you used an output file please submit only the output file
Marking criteria
The following criteria will be used to assess Assignment 5:
Task HD DI CR PS
Write and run SQL statements to complete tasks 1-12 above The SQL statements retrieve or update the required information for all assignment tasks using concise, correct and free of errors SQL syntax that The SQL statements retrieve or update the required information for most of the assignment tasks using correct and free of errors SQL syntax
The SQL statements retrieve or update the required information for some of the assignment tasks using mostly correct SQL syntax The SQL statements retrieve or update the required information for only a few of the assignment tasks using SQL syntax that contains frequent errors
GET ANSWERS / LIVE CHAT