Question
Design and clearly explain at least ten query scenarios that may be useful on your database. Write SQL syntax to answer each query. A query
Design and clearly explain at least tenquery scenarios that may be useful on your database. Write SQL syntax to answer each query. A query like this: select count(*) from tableOne, can only be used as one of the ten. Strongly suggested to include some queries using Table Joins, Aggregates, Group By, Order By, and Having. At least one query must use a view (that you created from your application tables) in the FROM clause. Note: the SELECT used for in the creation of the view, does not count as one of the 10 queries.
See database below (provide quick explanation for each query)
|Create Table Apartment (Apartment_number int primary key, Floor_plans varchar(50), insert_date date, update_date date); Create Table Agency (Agency_ID int primary key, Agency_name varchar(20), Agency_phone int, Agency_email varchar(50), insert_date date, update_date date); Create Table Resident (Resident_id int primary key, Resident_name varchar(20), Resident_phone int, Resident_email varchar(45), Apartment_number int, Agency_ID int, insert_date date,update_date date, Foreign key (Apartment_number) References Apartment (Apartment_number),Foreign key (Agency_ID) References Agency (Agency_ID)); Create Table Payment (Resident_bill int primary key, Agency_ID int, Resident_id int, payment_type int,insert_date date,update_date date, Foreign key (Resident_id) References Resident (Resident_id), Foreign key (Agency_ID) References Agency (Agency_ID) ); Create Table Records (Resident_bill int primary key, Agency_ID int, Record_status varchar(30), insert_date date, update_date date, Foreign key (Agency_ID) References Agency (Agency_ID), Foreign key (Resident_bill) References Payment (Resident_bill));
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