Lab2 4q
Lab2 4q
mysql> INSERT INTO Suppliers (sid, sname, address) VALUES(1, 'Acme Widget
Suppliers', '123 Acme St'),(2, 'Best Parts Inc.', '456 Best Ave'),(3, 'Quality
Supplies', '789 Quality Rd'),(4, 'Universal Supplies', '101 Universal Blvd');
Query OK, 4 rows affected (0.02 sec)
Records: 4 Duplicates: 0 Warnings: 0
mysql> CREATE TABLE Parts ( pid INTEGER PRIMARY KEY, pname VARCHAR(100) NOT
NULL, color VARCHAR(50));
Query OK, 0 rows affected (0.09 sec)
mysql> INSERT INTO Parts (pid, pname, color) VALUES(1, 'Widget', 'red'),(2,
'Gadget', 'blue'),(3, 'Doodad', 'green'),(4, 'Thingamajig', 'yellow'),(5,
'Contraption', 'red'),(6, 'Device', 'green');
Query OK, 6 rows affected (0.07 sec)
Records: 6 Duplicates: 0 Warnings: 0
mysql> CREATE TABLE Catalog ( sid INTEGER, pid INTEGER, cost REAL,
PRIMARY KEY (sid, pid), FOREIGN KEY (sid) REFERENCES Suppliers(sid) ON DELETE NO
ACTION, FOREIGN KEY (pid) REFERENCES Parts(pid) ON DELETE NO ACTION);
Query OK, 0 rows affected (0.13 sec)
mysql>