Saturday, August 22, 2020
Database Implementation and Queries
Questions: A. Comprehension and Implementation of the DatabaseUsing the provided blueprint document, make the database for CQR. The provided record populates all tables to mirror the substance of the curios gave in Assignment 1 and is a chopped down variant of the training at the end of business on fifteenth September 2014. . At this stage, you are to envision what the condition of the database would be at the end of business on the following day, subject to the necessities of this errand, and all resulting tasks.Write questions to discover the accompanying: Find the unused structures for example there is one Superannuation customer yet no Partnership customers on the starter database. Locate the unused segments; Find the unrequested administrations; Find the unused charging cost types; Find areas for which there is none or just a single current worker with that aptitude; Find the base charging rate for every representative sort for the latest charging rate compelling date;B. Test DataThis unde rtaking might be finished after you have completed this and every ensuing errand. You ought to make a solitary content fulfill this segments prerequisites; fulfill the particular situations plot underneath in segment C; and where important give significant information to the SQL questions determined in sectionD.Queries that are right and don't deliver yield utilizing your test information will lose half of the imprints apportioned so you ought to deliberately check your test information and guarantee it completely approves your SQL inquiries. For instance if a question approaches to show the full subtleties for all CLIENTS who have a TAS or a NT address then at any rate two lines are relied upon to be shown. On the off chance that the information gave in the provided composition record doesn't do this you have to work out a method of doing that and remember for your content file.There ought to be remarks in the content to clarify what is being done and to recognize what parts of the task are being secured. The content ought to contain a solitary COMMIT proclamation as the last line of the content, for example all supplements ought to be treated as a solitary exchange. The information ought to be organized so that once it has been embedded and the submit SQL order has been run, the database is in a steady state.Specifically for this segment, and utilizing the data acquired from the past area, you should include as a base: Three new customers. These customers should:o have a structure that has not been utilized yet;o work in areas that have not been utilized at this point (however may incorporate existing ones in the event that they work in more than one);o require administrations that have not been mentioned at this point (yet may incorporate existing ones);o have one of a kind charging on cost type charged to them for the afternoon; Two new representatives one Accountant and one Administrator. They need to:o in any event work in spaces for which there is none or just a single current worker with that expertise;o Have a charging rate equivalent to that of a similar representative sort with the base rate for that employee;C. Explicit Scenarios Manipulate the DatabaseIn the accompanying segment, the SQL contents should accurately oversee exchanges. You ought to likewise guarantee that any related information affected by your content activities are accurately managed.1. Another bookkeeper is to be included (accept it has not been refreshed from the HR framework). His name is Matthias Window. He has skill in Taxation and Corporate undertakings and will be charged out at a pace of $160.00 every hour from today (sixteenth September 2014).Include this new worker and his subtleties on the CQR database. Accept that the representative number for this new worker is 1 more than the biggest worker in the BILLINGEMPLOYEE table.2. His first work is to offer some expense guidance to a current customer who he believes is Bill Wilson. He goes through an ho ur from 8:30 doing as such however cant discover the administration type code so makes another one for gifts and uses that. He at that point proceeds onward to some exploration for 30 minutes for a current customer Richard Smith. In the two cases he neglects to enter in an end time.Include the subtleties of this succession of charging in the database.3. At 10:00 Matthias acknowledges he really worked for Bill Watson at first not Bill Wilson, that he ought to have utilized the correspondence code for that work and that he ought to have finished the occasions correctly.Include the subtleties of these revisions in the database.4. Matthias is then entrusted with finishing a corporate return for 2 Boys Plumbing Pty. Ltd. He gets the time wrong and keys in 9:30am and goes through 2 hours finishing the arrival, refreshing the culmination time to 11:30 when he is done. As a feature of the procedure he raises an on-cost record for the lodgement charge ($110.00) for the return.Include the abo ve changes in the database.5. Alan Counting lessens Matthias Windows charging rate by 25%.D. Questioning of Database utilizing SQL Statements1. Show the full subtleties for all customers - the name subtleties (firstname and lastname) ought to be appeared in one section called 'Customer Name' and the location subtleties (street1, street2, city, state and postcode) in one segment called Client Address'.2. Show the full subtleties for all customers who have a TAS or a NT address.3. Show the full subtleties for all help types in the CQR administration type table which have the word 'exhortation' (upper or lowercase) in any of their sections. 4. Alan is thinking about what the impact of expanding the charging rate on all representatives by 5% would be. Show the representative number, name, powerful date and expanded charging pace of all workers in CQR. 5. Show the full subtleties for the least expensive charging worker gave by CQR. 6. Show the subtleties of all customers for whom no char ging on cost records exist for the present year (2014). Show in customer linked firstname, lastname request. 7. Give the absolute number of representatives, all out charging rate, normal charging rate for the practice.8. Ascertain the absolute charges, barring on-costs per customer for the long stretch of September 2014.9. Show the worker number, customer number, administration ID and billingstarttime for administration sorts of Advice or Communication type where the real charge on any charging record is less expensive than $150 and the time span is somewhere in the range of 15 and 30 minutes. Request the rundown with the end goal that the billingrecords which are most economical are recorded first.10. For all customers right now in the CQR framework, show insights regarding the customers and those with segment records and those without part records: for every customer with divisions: show the string 'With areas', the customer number, customer first name connected with the customer last name, and the complete number of segments the customer is engaged with, and for every customer without segment records: show the string 'Without segments', the customer number, customer first name linked with the customer last name, and the all out number of segments as a string of Not applicable.11. Show subtleties everything being equal (number, name) for whom billingrecords have been made when they are not recognized as having that mastery for example those representatives who have charged to a help that they don't have a space record for. (2 marks)12. Select representative number and the unmistakable assistance from the billingrecords where any record for that administration took more than 1 hour to finish. You should just show one worker number, administration and depiction mix in any event, when various records qualify.13. Show the structure subtleties for which the littlest complete billable movement (time) has been acted in the most recent month (17-08-2014 to 16-09-201 4)14. Report the normal number of charging records per representative every day. Answers: A. Comprehension and Implementation of the Database Locate the unused structures for example there is one Superannuation customer yet no Partnership customers on the starter database Inquiry: SELECT * FROM structure WHERE StructureID NOT IN (SELECT StructureID FROM customer); Locate the unused parts Inquiry: SELECT * FROM Sector WHERE SectorID NOT IN (SELECT SectorID FROM ClientSector); Locate the unrequested administrations Inquiry: SELECT * FROM Service WHERE ServiceID NOT IN (SELECT ServiceID FROM ClientService); Locate the unused charging cost types Inquiry: SELECT * FROM BillingOnCostType WHERE BillingOnCostTypeID NOT IN (SELECT BillingOnCostTypeID FROM BillingOnCost); Discover spaces for which there is none or just a single current representative with that aptitude Question: SELECT * FROM Service WHERE ServiceID IN (SELECT ServiceID FROM EmployeeDomain WHERE EmployeeNumber IN (SELECT EmployeeNumber FROM EmployeeDomain GROUP BY EmployeeNumber HAVING COUNT(*)=0 OR COUNT(*)=1)); Locate the base charging rate for every representative sort for the latest charging rate successful date Question: SELECT et.EmployeeType,ber.BillingRateEffectiveDate,MIN(ber.BillingRate) AS MinBillingRate FROM BillingEmployeeRate ber,Billing Employee be,EmployeeType et WHERE ber.EmployeeNumber=be.EmployeeNumber AND be.EmployeeType=et.EmployeeType GROUP BY et.EmployeeType,ber.BillingRateEffectiveDate request by ber.BillingRateEffectiveDate DESC limit 4; B. Test Data: Supplement INTO Client (ClientFirstName,ClientLastName, ClientStreet1, ClientStreet2,ClientCity,ClientState,ClientPostcode, ClientContact, ClientContactPhone,ClientTFN,ClientABN,ClientAddDate,StructureID, ClientLink) VALUES ('John','Smith','24, TT Ct','', 'Ararat','NT',3300,'Henry Micheal','09494038585','98494398438','949934892874','2015-01-01',1,168750); Addition INTO Client (ClientFirstName,ClientLastName, ClientStreet1, ClientStreet2,ClientCity,ClientState,ClientPostcode, ClientContact, ClientContactPhone,ClientTFN,ClientABN,ClientAddDate,StructureID, ClientLink) VALUES ('Andrew','William','72, TT Ct','81 RR Ct','Gosfort','TAS',3302,'Nitin','4737445745','984324634634','9499342637565','2015-01-06',4,null); Addition INTO (Client First Name, Client Last Name, ClientStreet1, ClientStreet2,ClientCity,ClientState,ClientPostcode, ClientContact, ClientContactPhone,ClientTFN,ClientABN,ClientAddDate,StructureID, ClientLink) VALUES ('Stephen','Oliver','90, MM Street','120 PP Ct','Morwell','NSW',4200
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.