Write queries to find out the unused structures

Assignment Help Database Management System
Reference no: EM13839978

Assignment Specification- Database Implementation and Queries

Objectives:

To analyse and comprehend a provided ER diagram and Database Schema

To implement a database based on the provided ER diagram and Database Schema

To manipulate the data in the database

To write required SQL statements to query the database

Project Specification

The Case Study: CQR Accounting

After reviewing all the designs, defining the scope and long deliberations with Alan, Edward and Peter of CQR, the design of the database has been finalised. In this assignment you will use a ‘simplified' database model as depicted by the ERD in the accompanying document - ITECH1006-5006_Assignment2_201427_ER_Diagram.

Changes from assignment 1 have been implemented and include:

• No requirement for the following entities:

O EMPLOYEEQUALIFICATION

O QUALIFICATION

O DEPENDENTQUALIFICATION

O POSTCODE

O CITYSTATE O STATE

o BUSINESS - implemented within CLIENT

• No requirement for AuditSupervisor functionality so remove column and relationship from BILLINGEMPLOYEE;

• ClientContact and ClientABN are not always required so allow NULLs in these columns on CLIENT;

CLIENT;

• It was felt more information was needed about SERVICETYPE entries so a ServiceTypeNote column was added;

• Just having EmployeeNumber (provided by the HR system and not autoincremented) was deemed insufficient information so an additional column was added to store the EmployeeName from that system;

• BillingEndTime on BILLINGRECORD defaults to 6:00pm when a billing record is first entered. This is then changed when the employee completes the task.

For this assignment you follow a process of understanding the beginning database through examination and queries, populating it with appropriate test data and specific requests and then write some SQL queries. Penalties will apply to queries that use subqueries and views unnecessarily. The schema file for creating this model is available in the archive CQR-ass2-schm0901 - this file creates the above tables, their keys (primary and foreign) and populates all tables except BILLINGONCOST - you should read this schema carefully so that you are aware of the meaning of the various attributes. You must not alter the schema file in any manner, it must be used as supplied.

You may need to rerun the schema, especially when you have been experimenting with your solutions and may have corrupted the database unintentionally. If you suspect that there might be such a problem, rerun the schema.

A. Understanding and Implementation of the Database

Using the supplied schema file, create the database for CQR. The supplied file populates all tables to reflect the content of the artefacts provided in Assignment 1 and is a cut-down version of the practice at the close of business on 15th September 2014. . At this stage, you are to imagine what the state of the database would be at the close of business on the next day, subject to the requirements of this task, and all subsequent tasks.

Write queries to find out the following:

• Find the unused structures e.g. there is one Superannuation client but no Partnership clients on the starter database.

• Find the unused sectors;

• Find the unrequested services;

• Find the unused billing cost types;

• Find domains for which there is none or only one current employee with that expertise;

• Find the minimum billing rate for each employee type for the most recent billing rate effective date;

Include these queries and their output in a separate file with the identifier

ITECH1006_5006_StudentName_StudentNumber_Beginner_and_Specific_Queries. (15 marks)

B. Test Data

This task will only be completed after you have finished this and all subsequent tasks. You should create a single script -
ITECH1006_5006_StudentName_StudentNumber_Test_and_Scenario_Data_Script - which will contain the statements to insert the required data to:

• satisfy this section's requirements;

• satisfy the specific scenarios outlined below in section C; and

• where necessary provide meaningful data for the SQL queries specified in sectionD.

Queries that are correct and do not produce output using your test data will lose 50% of the marks allocated so you should carefully check your test data and ensure it thoroughly validates your SQL queries. For example if a query asks to display the full details for all CLIENTS who have a TAS or a NT address then at least two rows are expected to be displayed. If the data provided in the supplied schema file does not do this you need to work out a way of doing that and include in your script file.

There should be comments in the script to explain what is being done and to identify what parts of the assignment are being covered. The script should contain a single COMMIT statement as the last line of the script, i.e. all inserts should be treated as a single transaction. The data should be structured in such a way that once it has been inserted and the -commit- SQL command has been run, the database is in a consistent state.

Specifically for this section, and using the information obtained from the previous section, you should add as a minimum:

• Three new clients. These clients should:

o have a structure that has not been used yet; o operate in sectors that have not been used yet (but may include existing ones if they operate in more than one); o require services that have not been requested yet (but may include existing ones);

o have one unique billing on cost type charged to them for the day;

• Two new employees - one Accountant and one Administrator. They need to:

o at least work in domains for which there is none or only one current employee with that expertise;

o Have a billing rate the same as that of the same employee type with the minimum rate for that employee;

C. Specific Scenarios - Manipulate the Database

In the following section, the SQL scripts must correctly manage transactions. You should also ensure that any related data impacted by your script actions are correctly managed.

Copies of your SQL scripts should be placed in the ITECH1006_5006_StudentName_StudentNumber_Test_and_Scenario_Data_Script file

1. A new accountant is to be added (assume it has not been updated from the HR system). His name is Matthias Window. He has expertise in Taxation and Corporate affairs and will be charged out at a rate of $160.00 per hour from today (16th September 2014).

Include this new employee and his details on the CQR database. Assume that the employee number for this new employee is 1 more than the largest employee in the BILLINGEMPLOYEE table.

For ITECH5006 students, the value for employee number should be obtained through SQL, not hardcoded.

2. His first work is to give some tax advice to an existing client who he thinks is Bill Wilson. He spends an hour from 8:30 doing so but can't find the service type code so creates a new one for donations and uses that. He then moves on to some research for half an hour for an existing client Richard Smith. In both cases he forgets to key in an end time.

Include the details of this sequence of billing in the database.

For ITECH5006 students, the clients should be found with SQL, not hardcoded.

3. At 10:00 Matthias realises he actually worked for Bill Watson initially not Bill Wilson, that he should have used the communication code for that work and that he should have completed the times correctly.

Include the details of these corrections in the database.

For ITECH5006 students, insert new records and remove the old ones where applicable rather than modifying the existing ones.

4. Matthias is then tasked with completing a corporate return for 2 Boy's Plumbing Pty. Ltd. He gets the time wrong and keys in 9:30am and spends 2 hours completing the return, updating the completion time to 11:30 when he is finished. As part of the process he raises an on-cost record for the lodgement fee ($110.00) for the return.

Include the above changes in the database.

For ITECH5006 students, prevent the duplication of start times (he has already recorded a 9:30am time for another client) in your SQL.

5. Alan Counting reduces Matthias Window's billing rate by 25%.

For ITECH5006 students, also remove his domain expertise in taxation.

D. Querying of Database using SQL Statements

1. Display the full details for all clients - the name details (firstname and lastname) should be shown in one column called 'Client Name' and the address details (street1, street2, city, state and postcode) in one column called ‘Client Address'. (2 marks)

2. Display the full details for all clients who have a TAS or a NT address. (2 marks)

3. Display the full details for all service types in the CQR service type table which have the word 'advice' (upper or lowercase) in any of their columns. (2 marks)

4. Alan is considering what the effect of increasing the billing rate on all employees by 5% would be. Display the employee number, name, effective date and increased billing rate of all employees in CQR. (3 marks)

5. Display the full details for the cheapest billing employee provided by CQR. (3 marks)

6. Display the details of all clients for whom no billing on cost records exist for the current year (2014). Display in client concatenated firstname, lastname order. (3 marks)

7. Provide the total number of employees, total billing rate, average billing rate for the practice. (3 marks)

8. Calculate the total charges, excluding on-costs per client for the month of September (3 marks)

9. Display the employee number, client number, service ID and billingstarttime for service types of "Advice" or "Communication" type where the actual charge on any billing record is cheaper than $150 and the time duration is between 15 and 30 minutes. Order the list such that the billingrecords which are least expensive are listed first.

10. For all clients currently in the CQR system, display details about the clients and those with sector records and those without sector records:

• for each client with sectors: display the string 'With sectors', the client number, client first name concatenated with the client last name, and the total number of sectors the client is involved in, and

• for each client without sector records: display the string 'Without sectors', the client number, client first name concatenated with the client last name, and the total number of sectors as a string of ‘Not applicable'.

Note that that the results from this listing should be displayed in a single result output. Hint: Make use of the "UNION" relational operator as part of your SQL statement.

ITECH5006 students should also complete the following.

11. Display details of all employees (number, name) for whom billingrecords have been created when they are not identified as having that expertise i.e. those employees who have charged to a service that they do not have a domain record for. (2 marks)

12. Select employee number and the distinct service from the billingrecords where any record for that service took in excess of 1 hour to complete. You should only display one employee number, service and description combination even when multiple records qualify. (3 marks)

13. Display the structure details for which the smallest total billable activity (time) has been performed in the last month - (17-08-2014 to 16-09-2014)

14. Report the average number of billing records per employee per day. (2 marks)

Include the queries in the 5006_StudentName_StudentNumber_Beginner_and_Specific_Queries file.

Note: There are some general requirements when defining your select queries: You are required to adhere to the following output formatting conventions:

• All monetary values should be printed with a dollar symbol ($), two digits after the decimal point, and with space for 7 digits before the decimal point

• You must use consistent and legible formatting in laying out your SQL queries. Include (brief) comments for any query or procedure that uses an -unusual- approach.

What to submit

An electronic copy of your assignment should be submitted through Moodle and should include a copy of your report, completed according to the Federation University Australia General Guide for the Presentation of Academic Work and the two files described in Sections A to D -

ITECH1006_5006_StudentName_StudentNumber_Beginner_and_Specific_Queries

ITECH1006_5006_StudentName_StudentNumber_Test_and_Scenario_Data_Script

Your document should include:

• A copy of the input and output of you running all your SQL required for this assignment including: o Queries from section A; o Inserts of Data from section B;

o Execution of Data Manipulation from section C; and o Queries from section D.

• A bibliography containing a list of all resources used to complete the assignment. If no resources, apart from the course materials, have been used please indicate this.

Assessment Criteria

• How clear and well organised your presentation is. On the front page of your report you should include a list of acknowledgements of all people who have assisted you with this assignment including fellow students, along with a statement of completion.

• Adherence to our standards. How clear and well organised your presentation is. You should write all the queries in consistent style and use indent format.

• Data correctness and quality. Please use appropriate data for your examples (e.g. do not use inappropriate person names)

• Joining of data from multiple tables should be completed using a WHERE statement only. JOINs are not to be used within any of the SQL statements. Use of any JOINs will result in 0 (zero) marks being allocated for each SQL statement that utilizes them.

• Please refer to the provided marking guide (below) to see the distribution of marks.

Assignment Resources:

• This Assignment Specification

• The Standard ER Diagram

• Relational Database Schema

Hint: you need to decide the order that tables need to be created; and the order of tables in which data need to be inserted into.

Faculty of Science and Technology

Database Management Systems.

Reference no: EM13839978

Questions Cloud

How many units must montson produce to make direct materials : Montson, Inc. produces a product requiring three square feet at $6 per square foot. If the desired ending inventory is $18,000 and the beginning inventory is $36,000, how many units must Montson produce to make direct materials purchases $54,000?
The theory underlying the pv formula : According to the theory underlying the PV formula, would you prefer to receive a)$75 one year from now, b) $85 two years from now or c) $90 three years from now.  relevant market interest rate is 10% and will remain at that rate for the next 3 years...
Distribution of salaries : In the absence of outliers, do you think the distribution of salaries is symmetric, skewed to the left, or skewed to the right?
The death rate among patients in teaching hospitals : A friend tells you that you should never be a patient in a teaching hospital because the death rate among patients in teaching hospitals is higher than in other hospitals. (b) Write down a regression equation where the dependent variable is the death..
Write queries to find out the unused structures : Write queries to find out the unused structures e.g. there is one Superannuation client but no Partnership clients on the starter database.
Which one of the following appears to be least important : Your client says, “With the unrealized gains in my portfolio, I have almost saved enough money for my daughter to go to college in eight years, but educational costs keep going up.” Based on this statement alone, which one of the following appears to..
Compute amount of underapplied or overapplied overhead cost : Compute the amount of under applied or over applied overhead cost for the year - Prepare a schedule of cost of goods manufactured for the year.
Linear program using the graphical solution procedure : Solve the following linear program using the graphical solution procedure. Max z = 5x1 + 5x2 s.t. 1x1 ≤ 100
How does david ramsey organize his text : How does David Ramsey ORGANIZE his text? Why do you think he chose to organize it in this way? What role do the I4 DINGS throughout the essay play in the organization? What is the source of those headings

Reviews

Write a Review

Database Management System Questions & Answers

  Write sql statement to retrieve all data sorted in order

Generate the view called RepairSummary which shows only RepairInvoiceNumber, TotalCost, and TotalPaid. Illustrate the SQL statement to retrieve all RepairSummary data sorted by TotalCost.

  Vehiclerentaloz data warehousevehiclerentaloz is a large

vehiclerentaloz data warehousevehiclerentaloz is a large chain of vehicle rental company over 500 stores distributed

  Define calculations and format the table

internship at Mountain View Realty, a real estate firm that focuses in the North Utah County area. The previous intern developed a spreadsheet listing houses listed and sold during the last several months. She included addresses, location, list pr..

  Create an employee database

Create a report that contains the above data - be sure to include a Hampton University logo in your report.

  Justify a question on database management

When a student has not chosen a major at a university, the university often enters a value of "Undecided" for the major field. Is "Undecided" a way to represent the null value? Should it be used as a default value? Justify your answer carefully.

  Draw relationship diagram for arrays

Information Gathering Component is very important to a shopping cart system. You really want to develop a good algorithm for it. As a professional practice, you decided to first make a working plan in pseudocode before putting hands.

  Create a detailed erd using the data specifications

Discuss the process you went through to the appropriate data types, primary and foreign keys, and other constraints that are necessary to maintain the integrity of the database.

  Part a major change definition and facilitating

part a major change definition and facilitating forces1.discuss the differences between a voluntary change and an

  Create an xml representation of data

Create an xml representation of data describing various relational database management systems (e.g. Microsoft SQL Server, MySQL, ...)

  Create a new dataset called dsuser

Create a new DataSet called dsUser. Use the table tblLogin as the database table for this dataset. Do this in the same way you added datasets in the previous labs.

  Write an anonymous block that places a substitution variable

Write an anonymous block that places a substitution variable (&) into a local variable of type varchar2. You will need to convert the types and round them to nearest tens unit

  Identify the primary key of mpd

Create a SQL Select Query to pull Product_ID, Product_Description and Units_Sold for Product 85773 from the CSS.Sales table. Hint: do not use the CSS prefix in your query

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd