Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assignment # 1 Subqueries Due Date: As per dropbox Purpose: The purpose of this assignment is to help you: SQL and subqueries Instructions: Be sure
Assignment # Subqueries
Due Date: As per dropbox
Purpose: The purpose of this assignment is to help you:
SQL and subqueries
Instructions: Be sure to read the following general instructions carefully:
This assignment should be completed individually by all the students. Submit your solution through the dropbox.
Assignment :
Your files must be in sql script format txt for Turnitin so that they can be copied and run in SQL Developer. Marks will be deducted.
Using the Just Lee and City Jail database.
Use an sql subquery statement to answer the following:
The citys Crime Analysis unit has submitted the following data requests. Provide the SQL statements using subqueries to satisfy the requests.
List the shipping city and state for the order that had the shortest shipping delay.
Determine which author or authors wrote the books least frequently purchased by customers of JustLee Books.
Determine which customers placed orders for the most expensive book in terms of regular retail price carried by JustLee Books.
City jail
List the names of all criminals who have had any of the crime code charges involved in crime ID
List the information on crime charges for each charge that has had a fine below average and a sum paid above average.
Use a correlated subquery to determine which criminals did not have had probation period assigned.
HINT:
The following memo was used to create an initial database design ER model for the City Jail that indicates entities, attributes columns primary keys, and relationships.
MEMO
To: Database Consultant
From: City Jail Information Director
Subject: Establishing a CrimeTracking Database System
It was a pleasure meeting with you last week. I look forward to working with your company to create a muchneeded crimetracking system. As you requested, our project group has outlined the crimetracking data needs we anticipate. Our goal is to simplify the process of tracking criminal activity and provide a more efficient mechanism for data analysis and reporting. Please review the data needs outlined below and contact me with any questions.
Criminals: name, address, phone number, violent offender status yesno probation status yesno and aliases
Crimes: classification felony misdemeanor, other date charged, appeal status closed can appeal, in appeal hearing date, appeal cutoff date always days after the hearing date arresting officers can be more than one officer crime codes such as burglary, forgery, assault; hundreds of codes exist amount of fine, court fee, amount paid, payment due date, and charge status pending guilty, not guilty
Sentencing: start date, end date, number of violations such as not reporting to probation officer and type of sentence jail period, house arrest, probation
Appeals: appeal filing date, appeal hearing date, status pending approved, and disapproved
Note: Each crime case can be appealed up to three times.
Police officers: name, precinct, badge number, phone contact, status activeinactive
Additional notes:
A single crime can involve multiple crime charges, such as burglary and assault.
Criminals can be assigned multiple sentences. For example, a criminal might be required to serve a jail sentence followed by a period of probation.
Answer each or the questions with an sql statement that contains at least one subquery.
Hint: Use subqueries, and work inside out toward the result; that is retrieve the
employee number of N Smith, search for the codes of all courses he ever taught, and so on
Marks are and will entirely based only on correct result of code submitted.
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