Create the tables and appropriate constraints based on the following ER diagram. Use appropriate data types. Note that the size column should only accept S, M, or L. In addition the price column should only have values greater than zero. All columns in both tables are required. ====================== CATEGORY table: Category Cid Description ====================== PRODUCT table: pid description cid (fk) Price Size (S/M/L)

Respuesta :

Answer:

See explaination

Explanation:

CREATE TABLE CATEGORY

(

cid int NOT NULL,

description varchar2(1000),

PRIMARY KEY (cid)

);

CREATE TABLE PRODUCT

(

pid int NOT NULL,

description varchar2(1000),

cid int,

price int,

p_size varchar2(1),

CONSTRAINT chk_price CHECK (price>0),

CONSTRAINT chk_size CHECK (p_size in ('S','M','L')),

CONSTRAINT fk_cid FOREIGN KEY (cid) REFERENCES CATEGORY(cid)

);

ACCESS MORE
EDU ACCESS
Universidad de Mexico