In order to meet all the Assessment Criteria:
1. Complete task A27 Parameter Query
2. Provide at least 5 citations and a reference list (e.g. your excellent research on LEFT JOIN).
3. Provide explanations of your choice of SQL for at least 5 more queries.
Accountancy – An Introduction to Accounts CBA890 – SQL Assignment Using SQL Assignment SQL Assignment CBA890 There are three tasks. Task A is compulsory and must be answered in full in order to pass. Task B is optional and for those who wish to impress with their SQL skills. For the whole assignment, you must provide at least 5 citations and references to a resource such as W3Schools in relation to the SQL you use. You can use this Online SQL Interpreter: https://sql-js.github.io/sql.js/examples/GUI/ Or you can use one of the other Online SQL Lite Interpreters that use the SQL Lite database engine that have been mentioned in the course. Task A – Venables Limited Customer Contact System You must complete successfully every sub-task of Task A to pass this unit. Background You work as a consultant with Goldstar Consulting. Goldstar Consulting have recently started a project with the customer services department of Venables Limited. Venables Ltd sells light fittings products to consumers (i.e. not businesses). The customer services department has been using a spreadsheet to record client details (the consumers), interactions between staff and clients (called Activities) and the staff members. Your colleague, Angie Smith, started the engagement but has fallen sick. You pick up the engagement from Angie. Resources TAVenables-Assignmt.db – the database file you start with. TA4-Client.csv – a text file of client data that you will need for Task 4. TA15-Activity.csv – a text file of activity data that you will need for Task 15. First Steps The database contains the following tables: · User · Product · Client You might like to do the following before starting: 1. Use this command to see the table structures: SELECT "name", "sql" FROM "sqlite_master" WHERE type="table"; 2. Use a SELECT statement to view the contents of each table. Important You must answer all questions successfully in order to pass (A1 to A27). When you answer the questions, you must provide: 1. An explanation of your choice of SQL; 2. The SQL that you run; and 3. A screenshot of the output from the database (if you are inserting or deleting data, also use a SELECT statement to show evidence of the loaded or deleted data). TASK A1: Remove The ‘Product’ Table AC11.1 Angie tells you that she has started the database in a file called TAVenables-Assignment.db. She says that there is a table called ‘Product’ in the database that the client no longer needs. You must remove it. TASK A2: Remove All Data from the ‘Client’ Table AC10.1 Angie tells you that she loaded all the wrong data into the ‘Client’ table. You need to remove all the existing data from the ‘Client’ table. TASK A3: Remove Some Data from the ‘User’ Table AC10.2 Angie tells you that the client no longer wants users from the Finance department to be in the User table. Please remove all users who are in the Finance department. TASK A4: Load Data Into The ‘Client’ Table AC8.1 Angie thanks you for deleting the wrong Client data. She has found the correct text file that contains all the client data that needs loading. The file is named: TA4-Client.csv. You can download it from Moodle. Your task is to use the data in the file to make a SQL statement to load the Client data into the Client table. TASK A5: View The Data In The ‘Client’ Table AC1.1 You want to check that you have correctly loaded the Client data into the Client table. Use a SQL statement to show all records and all fields in the Client table. TASK A6: View all the Dentists in the ‘Client’ Table AC1.2 The Customer Services Manager (CSM) at Venables wants to see full details of all the dentists in the Client table. Write a SQL statement to return all details of Dentists. TASK A7: Use a Condition of Your Choice to Impress the CSM AC1.2 – use of imagination You decide to provide another SQL statement to view records from the Client table but this time using a different condition. Use your imagination to create a SQL statement that might be useful to the CSM. Explain why the SQL Statement might be useful to the CSM. TASK A8: Use Two Conditions - AND AC1.3 – use of AND The CSM asks to see all Clients who are ‘Dentists’ and ‘Silver’ level. TASK A9: Use Two Conditions - OR AC1.3 – use of OR The CSM asks to see all Clients who are ‘Dentists’ or are of ‘Silver’ level. TASK A10: Use Comparison Operator ‘>’ AC1.3 – Comparison Operator The CSM asks to see all Clients who onboarded in 2020 or later. TASK A11: Use Comparison Operator ‘<’ ac1.3="" –="" comparison="" operator="" the="" csm="" asks="" to="" see="" all="" clients="" who="" onboarded="" before="" 2019.="" task="" a12:="" use="" wildcard="" -="" %="" ac1.4="" -="" wildcard="" the="" csm="" asks="" to="" see="" all="" clients="" use="" ‘quickmail’="" for="" their="" email="" address.="" you="" only="" need="" to="" show="" client="" first="" name,="" last="" name,="" client="" level="" and="" client="" email.="" task="" a13:="" use="" wildcard="" -="" _="" (underscore)="" ac1.4="" -="" wildcard="" the="" csm="" asks="" to="" see="" all="" clients="" whose="" first="" names="" have="" exactly="" four="" characters="" only="" (and="" no="" more="" or="" less).="" you="" only="" need="" to="" show="" client="" first="" name,="" last="" name,="" client="" level="" and="" client="" email.="" task="" a14:="" order="" the="" results="" ac3.1="" the="" csm="" wants="" a="" list="" of="" all="" clients="" sorted="" by="" client="" profession="" in="" reverse="" alphabetical="" order.="" task="" a15:="" create="" a="" table="" with="" a="" primary="" key="" constraint="" ac6.1,="" ac7.1="" the="" csm="" wants="" a="" table="" called="" activity="" that="" will="" contain="" the="" interactions="" between="" venables="" customer="" service="" representatives="" and="" clients.="" you="" must:="" 1.="" explicitly="" define="" the="" primary="" key="" field.="" 2.="" explicitly="" declare="" the="" foreign="" key="" constraint="" on="" user_id="" linking="" the="" column="" to="" user.user_id="" 3.="" explicitly="" declare="" the="" foreign="" key="" constraint="" on="" client_id="" linking="" the="" column="" to="" client.client_id="" on="" moodle,="" there="" is="" a="" file="" named:="" ta15-activity.csv="" the="" file="" contains="" the="" field="" names="" and="" data.="" use="" this="" file="" to="" help="" you="" create="" the="" sql="" statement="" to="" load="" the="" activity="" data.="" task="" a16:="" load="" data="" into="" activity="" table="" ac8.1="" use="" a="" sql="" statement="" to="" load="" the="" activity="" data="" into="" the="" activity="" table.="" you="" will="" find="" the="" activity="" data="" in="" the="" text="" file="" you="" used="" above:="" ta15-activity.csv="" task="" a17:="" update="" all="" activity="" records="" based="" on="" calculation="" ac9.1="" –="" update="" of="" all="" data="" based="" on="" calculation="" the="" csm="" tells="" you="" that="" she="" wants="" every="" activity="" record="" to="" be="" updated="" as="" follows:="" the="" field="" act_duration_min="" to="" be="" updated="" with="" the="" minutes="" value="" of="" the="" seconds="" value="" in="" field="" act_duration_sec.="" write="" an="" update="" statement="" to="" perform="" the="" update="" on="" all="" records="" in="" the="" activity="" table.="" task="" a18:="" update="" all="" client="" records="" ac9.1="" –="" update="" of="" all="" data="" based="" on="" calculation="" each="" year,="" the="" csm="" sets="" a="" target="" for="" sales="" to="" each="" client.="" this="" is="" stored="" in="" client_target_spend.="" the="" amount="" the="" client="" has="" actually="" spent="" (so="" far)="" is="" stored="" in="" client_actual_spend.="" the="" csm="" tells="" you="" that="" she="" wants="" every="" client="" record="" to="" be="" updated="" as="" follows:="" the="" field="" client_remaining_spend="" to="" be="" updated="" with="" the="" difference="" between="" client_target_spend="" and="" client_actual_spend="" (use="" subtraction!).="" write="" an="" update="" statement="" to="" perform="" the="" update="" on="" all="" records="" in="" the="" client="" table.="" task="" a19:="" update="" staff="" training="" flag="" based="" on="" activity="" duration="" (a="" condition)="" ac9.2="" –="" update="" of="" all="" data="" based="" on="" a="" condition="" the="" csm="" tells="" you="" that="" it="" is="" a="" requirement="" that="" if="" activity="" time="" is="" greater="" than="" 1000="" seconds,="" then="" the="" activity="" needs="" to="" be="" flagged="" for="" staff="" training.="" you="" will="" create="" a="" sql="" statement="" to="" update="" the="" act_staff_training="" to="" ‘y’="" if="" the="" activity="" duration="" is="" greater="" than="" 1000="" seconds.="" task="" a20:="" list="" of="" client="" professions="" with="" a="" count="" of="" instances="" of="" each="" profession="" ac5.1="" the="" csm="" tells="" you="" that="" she="" wants="" to="" see="" a="" list="" of="" all="" distinct="" professions="" in="" the="" client="" table="" with="" a="" count="" of="" each="" instance="" of="" the="" profession.="" task="" a21:="" list="" of="" client="" professions="" with="" a="" count="" of="" instances="" of="" each="" profession="" –="" but="" only="" those="" professions="" with="" more="" than="" one="" instance="" ac5.1="" the="" csm="" tells="" you="" that="" she="" wants="" to="" see="" a="" list="" of="" all="" professions="" in="" the="" client="" table="" with="" a="" count="" of="" each="" instance.="" but="" this="" time="" she="" is="" only="" interested="" in="" seeing="" professions="" having="" more="" than="" one="" instance.="" task="" a22:="" sum="" up="" the="" total="" duration="" of="" all="" activities="" ac5.2="" the="" csm="" wants="" to="" know="" the="" total="" duration="" of="" all="" activities="" in="" seconds="" and="" minutes.="" there="" will="" be="" two="" fields="" in="" the="" output:="" one="" for="" the="" total="" seconds="" of="" all="" activities;="" and="" one="" for="" all="" the="" total="" minutes.="" task="" a23:="" count="" the="" number="" of="" activities="" ac5.2="" the="" csm="" wants="" to="" know="" the="" total="" number="" of="" activities="" in="" the="" activity="" table.="" task="" a24:="" average="" duration="" of="" the="" activity="" ac5.2="" the="" csm="" wants="" to="" know="" the="" average="" duration="" of="" activities="" in="" seconds="" and="" in="" minutes="" in="" the="" activity="" table.="" task="" a25:="" maximum="" and="" minimum="" durations="" ac5.2="" the="" csm="" wants="" to="" know="" the="" maximum="" and="" minimum="" duration="" in="" seconds="" of="" activities="" in="" the="" activity="" table.="" task="" a26:="" use="" a="" join="" ac2.1="" the="" csm="" wants="" to="" see="" a="" report="" with="" client="" first="" name,="" client="" last="" name,="" client="" level,="" activity="" type,="" activity="" date.="" the="" csm="" wants="" the="" output="" ordered="" by="" client="" last="" name="" so="" she="" can="" see="" how="" individual="" clients="" have="" been="" behaving.="" this="" will="" involve="" two="" tables.="" task="" a27:="" parameter="" query="" ac4.1="" software="" developers="" are="" developing="" a="" user="" interface="" in="" a="" new="" software="" application="" that="" will="" run="" on="" top="" of="" the="" database.="" there="" will="" be="" a="" new="" screen="" is="" called="" ‘="" client="" level="" and="" profession’="" and="" will="" display="" client="" name,="" profession,="" level,="" and="" contact="" information.="" there="" are="" two="" search="" fields="" based="" on="" client_profession="" and="" client_level.="" the="" user="" can="" select="" a="" level="" and="" profession.="" the="" interface="" will="" then="" return="" a="" list="" of="" clients="" that="" match="" what="" the="" user="" has="" entered.="" 1.="" write="" the="" sql="" that="" the="" new="" software="" will="" need="" to="" generate="" to="" perform="" this="" task.="" you="" should="" adapt="" it="" to="" show="" where="" the="" user="" needs="" to="" enter="" a="" parameter;="" and="" 2.="" write="" instructions="" for="" a="" user="" manual="" explaining="" how="" to="" use="" this="" screen.="" task="" b="" –="" tina’s="" garage="" database="" system="" this="" is="" an="" optional="" extension="" task="" for="" those="" seeking="" to="" impress="" with="" their="" sql="" skills.="" you="" will="" create="" up="" to="" 10="" interesting="" queries="" on="" tina’s="" garage="" database="" system="" or="" the="" venables="" limited="" database="" from="" task="" a.="" in="" all="" cases,="" you="" must:="" 1.="" create="" an="" interesting,="" plausible="" business="" requirement="" 2.="" explain="" the="" sql="" you="" will="" use="" 3.="" show="" the="" sql="" 4.="" show="" the="" output="" using="" a="" screenshot="" you="" might="" like="" to="" include="" queries="" that="" involve:="" ·="" multiple="" tables="" ·="" interesting="" use="" of="" conditions,="" functions,="" grouping="" and="" ordering="" ·="" testing="" constraints="" by="" applying="" the="" above="" guidance,="" you="" will="" demonstrate="" deeper="" application="" of="" sql="" skills="" to="" realistic="" business="" requirements="" and,="" if="" successful,="" meet="" the="" criteria="" for="" merit/distinction="" consideration.="" resource="" tbtinagarage-assignmt.db="" assignment="" deliverables="" 1.="" a="" completed="" assignment="" brief="" 2.="" a="" report="" containing="" your="" responses="" to="" the="" tasks="" 3.="" a="" sql="" lite="" database="" file="" named="">’>
.db containing the