assignment3

assignment3 - Assignment #3 1.)SQL> insert into...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 Assignment #3 1.)SQL> insert into customers values ('c007', 'Coke', 'Atlanta', '7') 1 row created. 2.)SQL> select cname, sum(qty) from customers c, orders o where (c.cid=o.cid) group by cname CNAME SUM(QTY) ------------- ---------- Allied 2400 ACME 3400 Tiptop 5300 Basics 1800 3.)SQL> select cname from customers c where not exists (select * from products p wh ere not exists(select * from orders o where c.cid=o.cid and p.pid=o.pid)) CNAME ------------- Tiptop 4.)SQL> select a.pname, b.pname from products a, products b where a.city=b.city and a.pname<b.pname PNAME PNAME ------------- ------------- pen razor folder pencil comb pencil comb folder brush case 5.) 6.)SQL> select ((price*(.1)) + price) as NewPrice from products p where p.city='Dal las' NEWPRICE ---------- 0.55 1.1 2.2 7.)SQL> alter table Customers add primary key (cid) Table altered. 8.)SQL> alter table orders add constraint orderFK foreign key (cid) references cust omers (cid) Table altered.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Sheet1 Page 2 9.)SQL> Delete from agents 6 rows deleted. 10.)SQL> Select * from agents no rows selected SQL> rollback Rollback complete. SQL> select * from agents AID ANAME CITY PERCENT --- ------------- -------------------- ---------- a01 Smith New York 6 a02 Jones
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/08/2008 for the course CSIS 3310 taught by Professor Guimares during the Spring '08 term at Kennesaw.

Page1 / 8

assignment3 - Assignment #3 1.)SQL&gt; insert into...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online