You are on page 1of 4

EXPERIMENT - 2

(2K21/CSE/02)

Supplier Table Query:

CREATE TABLE PUBLIC.SUPPLIER(


s_id int PRIMARY KEY,,
s_name varchar(20) NOT NULL,
rating int NOT NULL
);

Parts Table Query:

CREATE TABLE PUBLIC.PARTS(


p_id int PRIMARY KEY,,
p_name varchar(20) NOT NULL,
color varchar(10) NOT NULL
);

Catalogue Table Query:

CREATE TABLE PUBLIC.CATALOGUE(


s_id int NOT NULL,
p_id int NOT NULL,
p_cost int NOT NULL,
FOREIGN KEY(s_id) REFERENCES SUPPLIER(s_id),
FOREIGN KEY(p_id) REFERENCES PARTS(p_id),
PRIMARY KEY(s_id, p_id)
);

TABLES:
1) Supplier_Table

2) Parts_Table
3) Catalogue_Table

QUERIES:

1) Print Supplier names of red color:

2) Print Highest Rating Supplier:


3) Print Red and Green Parts Supplier ID:

4) Print Highest Cost Part Supplier Name:

5) Print Lowest Cost Part Supplier Name:


6) Supplier Names who fall in certain range of rating:

You might also like