Question: Write the SQL queries 5. (10%) The codename, secret identity name and designation of agents who have closed more cases in some town than some
Write the SQL queries



5. (10%) The codename, secret identity name and designation of agents who have closed more cases in some town than some other agent. You can assume that only the agent that leads a case can close it. 6. (10%) The code name and designation of agents who lead one of the earliest cases in some location (by year), and have only lead cases in one other location (two locations total). 7. (10%) Show the ID, name and profession of People who have been involved in the most cases in each location, along with the number of cases they have been involved in for that location, the name of the location and a column called secretly agent? which contains 1 if the person is secretly an agent or 0 if the person is not an agent. If you can print 'yes' and 'no' instead of 1 and 0, all the better. designation AgentID codename killLicense status Gender ID gender M 1..1 has Agents uses Passwords Genders 1..1 1 1 leadBy Username Password has secret Identity investigates PersonID M M CaseID works In M People M InvolvedIn M Cases 1 happens In name j year Profession M caseCount isCulprit title isclosed description Locations ProfessionID livesIn location LocationID 5. (10%) The codename, secret identity name and designation of agents who have closed more cases in some town than some other agent. You can assume that only the agent that leads a case can close it. 6. (10%) The code name and designation of agents who lead one of the earliest cases in some location (by year), and have only lead cases in one other location (two locations total). 7. (10%) Show the ID, name and profession of People who have been involved in the most cases in each location, along with the number of cases they have been involved in for that location, the name of the location and a column called secretly agent? which contains 1 if the person is secretly an agent or 0 if the person is not an agent. If you can print 'yes' and 'no' instead of 1 and 0, all the better. designation AgentID codename killLicense status Gender ID gender M 1..1 has Agents uses Passwords Genders 1..1 1 1 leadBy Username Password has secret Identity investigates PersonID M M CaseID works In M People M InvolvedIn M Cases 1 happens In name j year Profession M caseCount isCulprit title isclosed description Locations ProfessionID livesIn location LocationID
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
