Question: Write the primary key constraint for the Customer table. What happens if this statement is subsequently executed? ( 4 % ) Add a Postal Code
Write the primary key constraint for the Customer table. What happens if this
statement is subsequently executed?
Add a Postal Code field to the Customer table.
Display all the records in the Customer table.
Change the Phone number of CUSTID from to ;
and POSTALCODE MHF in the customer table.
Create a NAMED constraint for example: CHKPROVINCE that will only allow
Alberta AB British Columbia and Ontario ON values in the PROVINCE
column of the CUSTOMER table.
Which customers CUSTID LNAME, FNAME have the earliest and most recent
orders?
List all the customers CUSTID LNAME which have an R as the third character
in their last names.
Display all the fields from customer table by descending order of their LNAME
column.
Write a select statement to display all customers CUSTID LNAME, FNAME who
have ordered ITEMID WOMENS FLEECE PULLOVER
Display all the INVID, ITEMID, ITEMDESC and CURRPRICE from the inventory
table, where QUANTITYONHAND is less than Display all the fields from customer table by descending order of their LNAME
column.
Write a select statement to display all customers CUSTID LNAME, FNAME who
have ordered ITEMID WOMENS FLEECE PULLOVER
Display all the INVID, ITEMID, ITEMDESC and CURRPRICE from the inventory
table, where QUANTITYONHAND is less than
Write a select statement which should display the ITEMSIZE, COLOR,
CURRPRICE of ORDERID
Display each province and the total of all orders for each province with the heading
'Total Prov'.
Display Customer First Name, Last Name, and total of orders for each customer
who has ordered items.
How many customers have not ordered anything?
For each customer in the Customer table CUSTID LNAME, FNAME, SPENT
write a select statement that will display what they spent. 'Spent' is defined as
ORDERPRICE QUANTITY. Arrange the list by 'Spent' in descending order.
DROP TABLE IF EXISTS ORDERS;DROP TABLE IF EXISTS INVENTORY;DROP TABLE IF EXISTS ITEM;DROP TABLE IF EXISTS CUSTOMER;DROP SEQUENCE IF EXISTS ITEMSEQ;CREATE TABLE customer custid INT NOT NULL PRIMARY KEY,lname VARCHARfname VARCHARcity VARCHARprovince VARCHARphone BIGINT;CREATE TABLE inventory invid INT NOT NULL PRIMARY KEY,itemid INT NOT NULL,itemsize VARCHARcolor VARCHARcurrprice DECIMALquantityonhand INT;CREATE TABLE item itemid INT NOT NULL PRIMARY KEY,itemdesc VARCHARcategory VARCHAR;CREATE TABLE orders orderid INT NOT NULL PRIMARY KEY,invid INT NOT NULL,orderdate DATE,custid INT NOT NULL,orderprice DECIMALquantity INT;ALTER TABLE inventory ADD CONSTRAINT inventoryfkitemid FOREIGN KEY itemid REFERENCES item itemid;ALTER TABLE orders ADD CONSTRAINT ordersfkinvid FOREIGN KEY invid REFERENCES inventory invid;ALTER TABLE orders ADD CONSTRAINT ordersfkcustid FOREIGN KEY custid REFERENCES customer custid;INSERT INTO CUSTOMER custid lname fname, city, province, phoneVALUES 'HARRIS', 'PAULA', 'TORONTO', ON 'EDWARDS', 'MICHAEL', 'HAMILTON', ON 'GORDON', 'MARY', 'LONDON', ON 'MILLER', 'CHRISTOPHER', 'CALGARY', AB 'CHAN', 'LISA', 'EDMONTON', AB 'SMITH', 'PAULINE', 'SUDBURY', ON 'PEREZ', 'JORGE', 'CALGARY', AB 'NELSON', 'JANICE', 'VANCOUVER', BC 'CRUZ', 'TED', 'HAMILTON', ON 'TRUDEAU', 'WILLIAM', 'EDMONTON', AB 'MCGOVERN', 'PAUL', 'CALGARY', AB 'THOMPSON', 'JENNIFER', 'TORONTO', ON 'SMITH', 'JAMES', 'HAMILTON', ON;CREATE SEQUENCE ITEMSEQSTART WITH INCREMENT BY NO CACHE;INSERT INTO ITEM itemid itemdesc, categoryVALUES NEXT VALUE FOR ITEMSEQ, 'MENS WINTER BOMBER JACKET', 'MENS CLOTHING'NEXT VALUE FOR ITEMSEQ, 'MENS BROAD RIMMED HATS', 'MENS CLOTHING'NEXT VALUE FOR ITEMSEQ, 'WOMENS RUNNING SHORTS', 'WOMENS CLOTHING'NEXT VALUE FOR ITEMSEQ, 'WOMENS FLEECE PULLOVER', 'WOMENS CLOTHING'NEXT VALUE FOR ITEMSEQ, 'WOMENS LEATHER JACKET', 'WOMENS CLOTHING';INSERT INTO INVENTORY invid itemid, itemsize, color, currprice, quantityonhandVALUES S 'BLACK', M 'BROWN', L 'BLUE', XL 'WHITE', S 'WHITE', S 'BLACK', M 'BLUE', L 'RED',
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
