Saturday, August 22, 2020

Database Implementation and Queries

Questions: A. Comprehension and Implementation of the DatabaseUsing the provided mapping record, 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 form 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 prerequisites of this undertaking, and all resulting tasks.Write inquiries to discover the accompanying: Find the unused structures for example there is one Superannuation customer however no Partnership customers on the starter database. Locate the unused areas; Find the unrequested administrations; Find the unused charging cost types; Find spaces for which there is none or just a single current representative with that aptitude; Find the base charging rate for every worker type for the latest charging rate viable date;B. Test DataThis undert aking may be finished after you have completed this and every single ensuing assignment. You ought to make a solitary content fulfill this areas prerequisites; fulfill the particular situations laid out beneath in segment C; and where important give significant information to the SQL inquiries indicated in sectionD.Queries that are right and don't create yield utilizing your test information will lose half of the imprints assigned so you ought to deliberately check your test information and guarantee it completely approves your SQL questions. For instance if an inquiry approaches to show the full subtleties for all CLIENTS who have a TAS or a NT address then at any rate two columns are relied upon to be shown. In the event that the information gave in the provided construction 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 distinguish what parts of the task are being secured. The content ought to contain a solitary COMMIT articulation as the last line of the content, for example all additions 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 reliable state.Specifically for this area, and utilizing the data got from the past segment, 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 divisions that have not been utilized at this point (however may incorporate existing ones on the off chance 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 exceptional charging on cost type charged to them for the afternoon; Two new representatives one Accountant and one Administrator. They need to:o at any rate 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 area, the SQL contents should effectively 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 (expect 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 representative in the BILLINGEMPLOYEE table.2. His first work is to offer some assessment guidance to a current customer who he believes is Bill Wilson. He goes through an hour from 8:30 doing as such yet 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 thirty 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 amendments 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 fulfillment 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 above 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 assistance types in the CQR administration type table which have the word 'exhortation' (upper or lowercase) in any of their segments. 4. Alan is thinking about what the impact of expanding the charging rate on all workers by 5% would be. Show the worker number, name, successful date and expanded charging pace of all representatives in CQR. 5. Show the full subtleties for the least expensive charging worker gave by CQR. 6. Show the subtleties of all customers f or whom no charging on cost records exist for the present year (2014). Show in customer connected firstname, lastname request. 7. Give the complete number of representatives, all out charging rate, normal charging rate for the practice.8. Ascertain the complete charges, barring on-costs per customer for the period of September 2014.9. Show the worker number, customer number, administration ID and billingstarttime for administration sorts of Advice or Communication type where the genuine charge on any charging record is less expensive than $150 and the time term 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 as of now in the CQR framework, show insights concerning the customers and those with division records and those without area records: for every customer with areas: show the string 'With parts', the customer number, customer first name linked with the customer last name, and the absolute 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 connected 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 distinguished as having that skill for example those workers who have charged to a help that they don't have a space record for. (2 marks)12. Select worker number and the particular help from the billingrecords where any record for that administration took more than 1 hour to finish. You should just show one representative number, administration and depiction blend 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 worker 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 Question: SELECT * FROM structure WHERE StructureID NOT IN (SELECT StructureID FROM customer); Locate the unused divisions 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 worker with that skill 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 kind for the latest charging rate powerful 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); Supplement 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); Supplement 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

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.