Download presentation
Presentation is loading. Please wait.
Published byDominick Ford Modified over 9 years ago
1
SQL: Join Training Problems D. Christozov / G.Tuparov INF 280 Database Systems: SQL – Join Training Problems 1
2
Quack Consulting Database (1) D. Christozov / G.Tuparov INF 280 Database Systems: SQL – Join Training Problems 2
3
Quack Consulting Database (2) client_idclient_namecityregionphone A001AliceBolcoS111-1111 B002BillTranforW222-2222 C003CaitlinCalpasNE333-3333 D004ColinTranforW444-4444 L005LauraCalpasNE555-5555 D. Christozov / G.Tuparov INF 280 Database Systems: SQL – Join Training Problems 3 project_id client_idproj_startproj_endleader P01C00320130626NullSUE P02L00520130610NullTED P03A00120130701NullRAY P04C0032013071120130715TED P05L0052013061720130620SUE Clients Projects
4
Quack Consulting Database (3) skill_idskill_descrbilling_rate ANAnalysis60.00 DEDesign70.00 PRProgram50.00 CPConfig70.00 DDDatabase80.00 D. Christozov / G.Tuparov INF 280 Database Systems: SQL – Join Training Problems 4 consultantcons_nameskill_idregion RAYSmithPRW SUEJonesANNE TEDDoeDDNE URIRoeCPS Specialty Consultants
5
Quack Consulting Database (4) D. Christozov / G.Tuparov INF 280 Database Systems: SQL – Join Training Problems 5 project_idconsultantitemcost P01URIConnectors200.00 P01URIBoards900.00 P01SUECalculator20.00 P03RAYKeyboard100.00 P05TEDCharts5.00 P02TEDModem200.00 Tasks Purchases project_idconsultanttask_descrtask_starttask_end P01URIInst LAN20130627Null P01SUECost/Bene2013062620130630 P02TEDRelations20130610Null P03RAYCode SQL20130715Null P03TEDNormalize2013071320130715 P05TEDDraw DSD20130622Null
6
Quack Consulting Database (5) D. Christozov / G.Tuparov INF 280 Database Systems: SQL – Join Training Problems 6 project_idconsultantdatehours P01SUE201306265.0 P01SUE201306283.0 P03TED201307136.0 P01URI201306304.0 P03TED201307157.0 P05TED201306221.0 P03RAY201307154.0 P05TED201306243.0 Time
7
Training problems 2 1.Calculate the total amount of money every client has to pay for purchases. 2.Calculate the total amount of money every client has to pay for consultants. 3.Find clients and consultants in the same region. 4.Find clients that there is no consultants in the same region. 5.Find clients, whose projects don’t need purchases. 6.Find consultants who are working in projects ordered by clients, who are in the same region as the consultant. 7.List all Clients.* from the same region, where there are another client. 8.List Client.Name, Projects.Project_ID, Consultant.Cons_Name and Region for each project where Projects.Leader is from the same region as the client. 9.Show the total revenue (i.e. billing_rate*hours) generated by each consultant. Include Consultant and Cons_name in the result. 10.Show the Project_id, Consultant, task_descr, and total hours for each task which has not yet ended. D. Christozov / G.Tuparov INF 280 Database Systems: SQL – Join Training Problems 7 PhoneRegionCityNameClient_ID Clients Billing_rateDescriptionSkill_ID Specialty HoursDateConsultantProject_ID Time CostItemConsultantProject_ID Purchases Leader Project_end Project_startClient_IDProject_ID Projects Task_endTask_startTask_descrConsultantProject_ID Tasks RegionSkill_IDNameConsultant
8
D. Christozov INF 280 Database Systems SQL:Join 8 Case: Vehicles_claims V_idDate_SoldC_idDateCostMileagePart 0012005/12/040012006/03/12100.00500P001 0022006/01/020022006/03/12200.00300P001 0022006/01/020032006/04/15120.001200P004 0022006/01/020052006/08/2054.001800P213 0032006/01/230042006/05/1734.00800P325 0032006/01/230062006/09/0912.001100P034 Vehicles_claims Find the average mileage accumulation between claims of vehicles with multiple claims. Note: Rows are ordered by V_id.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.