Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Questions 1-6 are for the able above. 1. Write the SQL Statement(s) to create th

ID: 3658241 • Letter: Q

Question

Questions 1-6 are for the able above.

1. Write the SQL Statement(s) to create these tables ? be sure to note Primary and Foreign Keys and CONSTRAINTS.

2. Write the SQL statement to print the following ? REMEMBER TO USE JOINS AND ORDER BY!:

AGENT NAME, CUST LNAME, CUS_INSURE-TYPE, CUS_RENEW_DATE.

3. Update Amy O?Brian to have an insure amount of $1,000.

4. Create a new agent and customer in their respective tables.

5. Delete Leona Dunn from the CUSTOMER table.

6. For the above create the physical model ? note primary, foreign keys, and data types.

Explanation / Answer

Please rate this to get rewarded

1)CREATE TABLE AGENT(AGENT_CODE int,AGENT_LNAME varchar(20),AGENT_FNAME varchar(20),AGENT_INTIAL char(1),AGENT_AREACODE int,AGENT_PHONE int,PRIMARY KEY (AGENT_CODE))

CREATE TABLE CUSTOMER(CUS_CODE int,CUS_LNAME varchar(30),CUS_FNAME VARCHAR(30),CUS_INTIAL char(1),CUS_AREACODE int,CUS_INSURE_TYPE char(2),CUS_INSURE_AMT money,CUS_RENEW_DATE datetime,AGENT_CODE int,PRIMARY KEY (CUS_CODE),FOREIGN KEY (AGENT_CODE) REFERENCES AGENT(AGENT_CODE))
2)
SELECT A.AGENT NAME, C.CUST LNAME, C.CUS_INSURE_TYPE, C.CUS_RENEW_DATE FROM AGENT A JOIN CUSTOMER C ON A.AGENT_CODE=C.AGENT_CODE
3)
UPDATE CUSTOMER SET CUS_INSURE_AMT=1000WHERE CUS_CODE=10015
4)
INSERT INTO AGENT VALUES(504,'NAREN','GADDU','T',615,123-456)
INSERT INTO CUSTOMER VALUES(10020,'SANTH','KARAN','G',615,267-4321,'E1',100.00,'22-JUL-12',506)
5)
DELETE FROM CUSTOMER WHERE CUS_CODE=10011