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....

1 answer below »





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
Answered 1 days AfterJun 21, 2021

Answer To: Accountancy – An Introduction to Accounts CBA890 – SQL Assignment Using SQL Assignment SQL...

Ali Asgar answered on Jun 23 2021
130 Votes
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 Onlin
e 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 A
Firstly we used the below SQL to know the initial format of our database.
SELECT `name`, `sql`
FROM `sqlite_master`
WHERE type='table';
Task A1:
Explanation: We need to delete an entire table for this we use the DROP command.
SQL: DROP TABLE 'Product'
We then re-ran the initial script to find the status of database.
SELECT `name`, `sql`
FROM `sqlite_master`
WHERE type='table';

Task A2
We use a select statement to find the contents of the Client Table
SQL: SELECT * FROM Client
Explanation: To Delete all data from a table, we use the “Delete From ” command without the “Where” clause. This deletes all data from the table, but leaves the table structure as is.
SQL: DELETE FROM Client
SELECT * FROM Client
Task A3
SELECT * FROM User;
Explanation: When we need to Use “Delete From
” command with a “where” clause to delete rows with specific conditions.
We use Where clause with User_Dept=”Finance” to select all users with Finance dept.
SQL: DELETE FROM User WHERE User_Dept="Finance";    
SELECT * FROM User;
Task A4
Explanation: We use “INSERT INTO
(Column1,Column2…) VALUES ((R1Value1, R1Value2…),(R2Value1,R2Value2…),…) command. This command lets us insert multiple rows in a table with a single INSERT INTO command.
SQL:
INSERT INTO Client
( Client_Id,Client_Fst_Name,Client_Last_Name,Client_Profession,Client_Level,Client_Onboard_Date,
Client_Street,Client_City,Client_Postcode,Client_Phone,Client_Email,Client_Target_Spend,
Client_Actual_Spend,Client_Remaining_Spend)
VALUES
(1,"Dilara","Spooner","Dentist","Gold","2018-06-10","14,Herbert Street","Reading","RG6 8HF","+44-765-559-2780","[email protected]",20000.00,15674.89,0.00),
(2,"Aron","Chen","Office Manager","Silver","2019-07-12","80,Centre Court","Liverpool","L7 0JU","+44-745-553-9891","[email protected]",5000.00,1321.05,0.00),
(3,"Ajay","Felix","Office Manager","Silver","2020-02-01","87,Goodwood Cross","Newry","NE10 7PN","+44-735-551-0050","[email protected]",7000.00,4377.47,0.00),
(4,"Ralphie","Kirby","Consultant","Bronze","2019-09-23","42,Hogarth Paddocks","London","NW14 7AW","+44-745-556-3461","[email protected]",1000.00,2287.66,0.00),
(5,"Gabija","Justice","Dentist","Silver","2019-10-10","52,St Stephen's Maltings","Manchester","M3 7UR","+44-755-552-0440","[email protected]",6000.00,2965.42,0.00),
(6,"Balraj","Singleton","Sales Executive","Gold","2019-03-01","64,Sea Orchards","Newcastle upon Tyne","N41 7RP","+44-795-557-0017","[email protected]",10000.00,8513.92,0.00),
(7,"Caleb","English","Dentist","Silver","2020-04-04","45,Manor Park","Peterborough","PB17 3HS","+44-715-552-1889","[email protected]",8500.00,3728.89,0.00);
Task A5
Explanation: the SELECT command is used to query a database for any data. The SELECT * FROM
retrieves all data from the mentioned table.
SQL: SELECT * FROM Client
Task A6
Explanation: the SELECT command is used to query a database for any data. The SELECT * FROM
WHERE retrieves rows data from the mentioned table that meet a specified condition.
SQL:
SELECT * FROM Client
WHERE Client_Profession = "Dentist"
Task A7
SELECT * FROM Client
WHERE Client_Target_Spend > 8000;
Task A8
Explanation: the...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here