Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Find out all sales records for product 1X1 and 2X2 CREATE TABLE soldvia ( productid CHAR(3) NOT NULL, tid VARCHAR(8) NOT NULL, noofitems INT NOT

Find out all sales records for product 1X1 and 2X2

CREATE TABLE soldvia (
productid CHAR(3) NOT NULL,
tid VARCHAR(8) NOT NULL,
noofitems INT NOT NULL,
PRIMARY KEY (productid, tid),
FOREIGN KEY (productid) REFERENCES product(productid),
FOREIGN KEY (tid) REFERENCES salestransaction(tid)
);

INSERT INTO soldvia VALUES ('1X1','T111',1);
INSERT INTO soldvia VALUES ('2X2','T222',1);
INSERT INTO soldvia VALUES ('3X3','T333',5);
INSERT INTO soldvia VALUES ('1X1','T333',1);
INSERT INTO soldvia VALUES ('4X4','T444',1);
INSERT INTO soldvia VALUES ('2X2','T444',2);
INSERT INTO soldvia VALUES ('4X4','T555',4);
INSERT INTO soldvia VALUES ('5X5','T555',2);
INSERT INTO soldvia VALUES ('6X6','T555',1);
INSERT INTO soldvia VALUES ('7X7','T666',1);
INSERT INTO soldvia VALUES ('9X9','T666',1);
INSERT INTO soldvia VALUES ('1X3','T666',2);
INSERT INTO soldvia VALUES ('8X8','T777',1);
INSERT INTO soldvia VALUES ('1X4','T888',4);
INSERT INTO soldvia VALUES ('2X3','T888',3);
INSERT INTO soldvia VALUES ('9X9','T999',1);

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Logics For Databases And Information Systems

Authors: Jan Chomicki ,Gunter Saake

1st Edition

1461375827, 978-1461375821

More Books

Students also viewed these Databases questions

Question

Why? What will be my payoff?

Answered: 1 week ago