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

Please help on constraints! Schema is given above. Consider the following relati

ID: 3577384 • Letter: P

Question

Please help on constraints! Schema is given above.

Consider the following relational schema and corresponding sample data: Product model, type, maker) Distributor (model, name, price) PC model, speed, ram, hd) Laptop (model, speed, ram, hd, screen) Printer (model, color, type) The keys are underlined. Distributor.model, PC.model, Laptop.model, and Printer.model are all forcign keys to Product.model. Referential integrity constraints are enforced through CASCADE for DELETE and SET NULL for UPDATE, respectively mode 100001 1000022.1161024 1000033.2 32 8192 1000042.7 64 8192 1000052.532 4096 1000062.2164096 3.2 324096 model type 100001 pc 100002 pc 100003 pc 100004 pc 100005 pc 100006 pc 200001 laptop P4 200002 laptop P5 200003 laptop Pl 200004 laptop P3 200005 laptop P3 200006 laptop P2 200007 laptop P4 200008 laptop P1 200009 laptop Pl 200010 laptop PI 30000 printer P6 300002 printer P6 300003 printer P2 300004 printer P3 300005 printer P3 model 100001D3 100002 D 100004 D 100005 D 200003 DI 200003 D2 200003 D3 200004P3 200008P3 200009P3 200010 Di 200010D2 er name price P2 P2 630 550 1000 800 980 P2 hd screen model spee 200001 2000022.116 1024 2000033.2 32512 3.2 16 4096 13 880 620 2000042.7 2000052.5 8 4096 82048 82048 570 2000062.2164096 2000072.2 200007 P3 200007P2 890 13 2000083.2324096 200009 2.8 2000103.2 32512 200004 D3 200004P1 200004 P2 300004 D3 300002DI 300002D3 300001 P3 13 180 model color type 300001 T 300002 T 300003 F 300004 F 300005 F lascr laser aser laser

Explanation / Answer

the tables will be created as follows:

CREATE TABLE Product
(
model varchar2(50) not null,
type varchar2(50) not null,
maker varchar2(50) not null
CONSTRAINT pk_model PRIMARY KEY (model)
Check (type = 'Pc' or type = 'laptop' or type = 'printer' )
);

CREATE TABLE Product
(
model varchar2(50) not null,
name varchar2(50) not null,
price varchar2(50) not null
CONSTRAINT pk_model PRIMARY KEY (model,name)
CONSTRAINT fk_model
FOREIGN KEY (model)
REFERENCES Product(model)
);

CREATE TABLE Pc
(
model varchar2(50) not null,
speed varchar2(50) not null,
ram varchar2(50) not null,
hd varchar2(50) not null
CONSTRAINT pk_model PRIMARY KEY (model)
CONSTRAINT fk_model
FOREIGN KEY (model)
REFERENCES Product(model)
   Check (model>99999 and model/100000=1)
);

CREATE TABLE laptop
(
model varchar2(50) not null,
speed varchar2(50) not null,
ram varchar2(50) not null,
hd varchar2(50) not null,
screen varchar2(50) not null
CONSTRAINT pk_model PRIMARY KEY (model)
CONSTRAINT fk_model
FOREIGN KEY (model)
REFERENCES Product(model)
   Check (model>99999 and model/100000=2)
);

CREATE TABLE Printer
(
model varchar2(50) not null,
type varchar2(50) not null,
color varchar2(50) not null
CONSTRAINT pk_model PRIMARY KEY (model)
CONSTRAINT fk_model
FOREIGN KEY (model)
REFERENCES Product(model)
   Check (model>99999 and model/100000=3)
);

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