Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The database consists of five tables: Establishment, Employee, Inspection, Violation, and Inspection _ Point. The key symbol indicates which attribute is the key field for
The database consists of five tables: Establishment, Employee, Inspection, Violation, and InspectionPoint. The key
symbol indicates which attribute is the key field for the table. The relationship lines indicate foreign keys.
Each Establishment has multiple inspections. Each Inspection is for one Establishment.
Each Employee has one Supervisor. Each Supervisor manages multiple Employees.
Each Employee does multiple Inspections. Each Inspection is done by one Employee.
Each Inspection can have multiple Violations. Each Violation occurs on one Inspection.
An Inspection can cause a single Followup Inspection.
Each InspectionPoint can apply to multiple Violations. Each Violation is for one InspectionPoint.
For each information request below, formulate a single SQL query to produce the required information. In each
case, you should display only the columns requested. Be sure that your queries do not produce duplicate records
unless otherwise directed. In some cases, there are several queries that may be correct, but the problem definition
may specify a particular approach. In that case, be sure you write the query exactly as specified.
Make a list of inspectionid fine, and inspectorcomment from violations with an inspectionpoint category of
'toxic items'. Only include those violations where the assessed fine was zero dollars.
List the inspections inspectionid with their date and type for all inspections that had a violation, including the
category, in the category of 'personnel' for January Also print the description of the inspectionpoint that
was violated.
List Employeeid and Employee First and Last Name of those employees who earn at least as much as their
manager's salary. Include in your answer the employee's salary and the manager's id number and salary. Name the
column of the Supervisor's Salary as SupSalary.
For employee make a list of all the establishments heshe has inspected. Include the employee's first and
last names, the license number of the establishment, and the DBA name. Also include the date of the inspection
with the results and the fine that was imposed. Sort the output by inspection date.
Make a list of all establishments that have had an inspection violation in the category of 'Toxic Items'. Include in
your answer DBA Name, inspection date and type, and any fine as well as the category.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started