Question: My Question dissapeared. Please help again the sql syntax that satisfy the questions below INSERT STATEMENT LINK BELOW https://drive.google.com/file/d/1qHCkrods5K2V1syyS5IG6-Eb_3QQmud7/view?usp=sharing TABLE SQL -- MySQL Script generated

My Question dissapeared. Please help again

the sql syntax that satisfy the questions below

INSERT STATEMENT LINK BELOW

https://drive.google.com/file/d/1qHCkrods5K2V1syyS5IG6-Eb_3QQmud7/view?usp=sharing

My Question dissapeared. Please help again the sql syntax that satisfy the

TABLE SQL

-- MySQL Script generated by MySQL Workbench -- Sun Feb 21 00:00:31 2021 -- Model: New Model Version: 1.0 -- MySQL Workbench Forward Engineering

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';

-- ----------------------------------------------------- -- Schema mydb -- -----------------------------------------------------

-- ----------------------------------------------------- -- Table state -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS state ( state_id INT NOT NULL AUTO_INCREMENT, name VARCHAR(45) NOT NULL, abb VARCHAR(2) NOT NULL, PRIMARY KEY (state_id), UNIQUE INDEX abb_UNIQUE (abb ASC)) ENGINE = InnoDB;

-- ----------------------------------------------------- -- Table address -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS address ( address_id INT NOT NULL AUTO_INCREMENT, street1 VARCHAR(45) NOT NULL, street2 VARCHAR(45) NULL, city VARCHAR(45) NOT NULL, zip VARCHAR(5) NOT NULL, state_id INT NOT NULL, PRIMARY KEY (address_id), INDEX FK_ADDRESS_STATE_IDX (state_id ASC), CONSTRAINT FK_ADDRESS_STATE FOREIGN KEY (state_id) REFERENCES state (state_id) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB;

-- ----------------------------------------------------- -- Table person -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS person ( person_id INT NOT NULL AUTO_INCREMENT, first_name VARCHAR(45) NOT NULL, last_name VARCHAR(45) NOT NULL, sex VARCHAR(1) NOT NULL, dob DATETIME, address_id INT NULL, PRIMARY KEY (person_id), INDEX FK_PERSON_ADDRESS_IDX (address_id ASC), CONSTRAINT FK_PERSON_ADDRESS FOREIGN KEY (address_id) REFERENCES address (address_id) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB;

-- ----------------------------------------------------- -- Table branch -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS branch ( branch_no VARCHAR(5) NOT NULL, address_id INT NOT NULL, PRIMARY KEY (branch_no), INDEX FK_BRANCH_ADDRESS_IDX (address_id ASC) COMMENT ' ', UNIQUE INDEX ADDRESS_ID_UNIQUE (address_id ASC), CONSTRAINT FK_BRANCH_ADDRESS FOREIGN KEY (address_id) REFERENCES address (address_id) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB;

-- ----------------------------------------------------- -- Table staff -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS staff ( staff_no VARCHAR(5) NOT NULL, person_id INT NOT NULL, position VARCHAR(45) NULL, salary INT NULL, branch_no VARCHAR(5) NOT NULL, PRIMARY KEY (staff_no), INDEX FK_STAFF_PERSON_IDX (person_id ASC), UNIQUE INDEX PERSON_ID_UNIQUE (person_id ASC), INDEX fk_staff_branch1_idx (branch_no ASC), CONSTRAINT FK_STAFF_PERSON FOREIGN KEY (person_id) REFERENCES person (person_id) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT fk_staff_branch1 FOREIGN KEY (branch_no) REFERENCES branch (branch_no) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB;

SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

Q4) Show clients that have 3 or more properties for rent. Order by the number of properties for rent in descending order. first name I last_name | client_properties | Heidi | Nicolas Evelia Deon | Elmer | Reggie | Coffin | Hetherington | Patty | Bridgett | Hodak | Sartor 4 31 31 31 3 31 6 rows in set Q5) Show the properties for rent if that property's rent is (1) larger than the average rent for all other properties combined. (2) Limit the result to properties that have a client number (i.e. client_no cannot be null). Your query should also show by how much the rent is higher for each property. Order by the rent difference property_no prop_type | staff_no | client_no | rooms | state difference IPR512 PR232 | PR875 | PR127 1PR655 | PR131 PR810 | PR343 | PR431 1 I | Flat | Condo | Condo | Flat | House | Flat | Flat | Flat 1 House I 1 | SG530 | SL557 | S0537 | NULL | SG508 | NULL | SQ574 | NULL | S0551 II | CR228 | CR191 | CR147 | CR148 | CR195 | CR244 | CR170 | CR222 | CR183 IT 4 | Oklahoma 4 | Georgia 15 | North Carolina | Michigan 12 | Alaska 18 | Florida | Minnesota 13 | Maryland Ii | Michigan III i 1 1 1.2600 19.2600 59.2600 85.2600 150.2600 173.2600 228.2600 255.2600 390.2600 1 1 1 41 rows in set 06) Show properties for sale, the property's state, the property's branch, and the state of that branch. Order by the rent from highest to lowest. Note that the branch and property states may be different addresses. To distinguish between the addresses, the query must use two independent copies of the address and state tables. The following query uses myTable twice as two separate copies. SELECT * FROM myTable t1, myTable t2, ... WHERE

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!