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

Use the following tables to answer the questions 1-5 : CUSTOMERS(cid, cname, cit

ID: 3675221 • Letter: U

Question

Use the following tables to answer the questions 1-5 :

CUSTOMERS(cid, cname, city, discnt)

AGENTS(aid, aname, city, percent)

PRODUCTS(pid, pname, city, quantity, price)

ORDERS(ordno, month, cid, aid, pid, qty, dollars)

1) Insert a new row in customers with cid = ‘c007’, name is ‘Coke’, city = ‘Atlanta’, and discount is 7

2) Increase by 10% the price of all products located in ‘Dallas’ (Interactive SQL -> Data Definition Language and Data Manipulation Language). [The formula for increasing the price is : price = price * 1.1]

3) Change the discount for customer ACME in Kyoto to 15.

4) Make cid the primary key of customers (ALTER TABLE command).

5) Make cid the foreign key of orders (ALTER TABLE command).

6) What command is used to delete a Table?

Explanation / Answer

1.ans:

insert into CUSTOMERS values('c007','Coke','Atlanta',7)

2.ans:

update PRODUCTS set price=price*1.1 where city='Dallas'

3.ans:

update CUSTOMERS set discnt=15 where cname='ACME' and city='Kyoto'

4.ans:

ALTER TABLE CUSTOMERS ADD CONSTRAINT primary key(cid)

5.ans:

Alter TABLE ORDERS ADD CONSTRAINT fk_k FOREIGN KEY(cid) REFERENCES CUSTOMERS(cid)

6.ans:

DROP TABLE customers //(any table)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote