Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

these answers are all wrong i need the correct sql command please. below is the schema. (LocationNum DECIMAL (2,0) PRIMARY KEY, LocationName CHAR(25), Address CHAR(25),

these answers are all wrong i need the correct sql command please. below is the schema.

(LocationNum DECIMAL (2,0) PRIMARY KEY, LocationName CHAR(25), Address CHAR(25), City CHAR(25), State CHAR(2), PostalCode CHAR(5) ); CREATE TABLE CondoUnit (CondoID DECIMAL(4,0) PRIMARY KEY, LocationNum DECIMAL (2,0), UnitNum CHAR(3), SqrFt DECIMAL(5,0), Bdrms DECIMAL(2,0), Baths DECIMAL(2,0), CondoFee DECIMAL(6,2), OwnerNum CHAR(5) ); CREATE TABLE Owner (OwnerNum CHAR(5) PRIMARY KEY, LastName CHAR(25), FirstName CHAR(25), Address CHAR(25), City CHAR(25), State CHAR(2), PostalCode CHAR(5) ); CREATE TABLE ServiceCategory (CategoryNum DECIMAL(4,0) PRIMARY KEY, CategoryDescription CHAR(35) ); CREATE TABLE ServiceRequest (ServiceID DECIMAL(4,0) PRIMARY KEY, CondoID DECIMAL(4,0), CategoryNum DECIMAL(4,0), Description CHAR(255), Status CHAR(255), EstHours DECIMAL(4,2), SpentHours DECIMAL(4,2), NextServiceDate DATE ); sqlite> .schema CREATE TABLE Location (LocationNum DECIMAL (2,0) PRIMARY KEY, LocationName CHAR(25), Address CHAR(25), City CHAR(25), State CHAR(2), PostalCode CHAR(5) ); CREATE TABLE CondoUnit (CondoID DECIMAL(4,0) PRIMARY KEY, LocationNum DECIMAL (2,0), UnitNum CHAR(3), SqrFt DECIMAL(5,0), Bdrms DECIMAL(2,0), Baths DECIMAL(2,0), CondoFee DECIMAL(6,2), OwnerNum CHAR(5) ); CREATE TABLE Owner (OwnerNum CHAR(5) PRIMARY KEY, LastName CHAR(25), FirstName CHAR(25), Address CHAR(25), City CHAR(25), State CHAR(2), PostalCode CHAR(5) ); CREATE TABLE ServiceCategory (CategoryNum DECIMAL(4,0) PRIMARY KEY, CategoryDescription CHAR(35) ); CREATE TABLE ServiceRequest (ServiceID DECIMAL(4,0) PRIMARY KEY, CondoID DECIMAL(4,0), CategoryNum DECIMAL(4,0), Description CHAR(255), Status CHAR(255), EstHours DECIMAL(4,2), SpentHours DECIMAL(4,2), NextServiceDate DATE );

List the number of bedrooms and average condo fee by bedrooms for condo units that are larger than 700 square feet and the average condo fee is less than $500.00. Sort the results by the average condo fee.

Your Answer: wrong

SELECT COUNT(Bdrms), AVG(CondoFee)

Group by Bdrms

having sqrft > 700 AND

AVG(CondoFee) < 500

OrderBy AVG(CondoFee);

List the condo id and description for every service request that contains "kitchen" in the description.

Your Answer:

SELECT CondoID, Description

FROM CondoUnit, ServiceRequest

WHERE CondoUnit.CondoID = ServiceRequest.CondoID

AND ServiceRequest.Description = 'Kitchen';

List the location number, average square footage, and average condo fee at each location.

Your Answer: wrong

SELECT locationNum, avg(sqrFt) AverageSquareFeet, avg(CondoFee)

FROM Location, CondoUnit

WHERE location.locationNum = CondoUnit.locationNum;

For every service request, list the last name and first name of the owner and the category and description of the service. Sort the results by service category.

Your Answer:wrong

SELECT lastName, FirstName, CategoryNum, Description FROM

Owner, ServiceRequest, CondoUnit

WHERE Owner.ownerNum = CondoUnit.OwnerNum AND

ServiceRequest.CondoID = CondoUnit.COndoID

AND OrderBy CategoryNum;

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions