Question
SQL Query and analize Please help
CREATE TABLE ProductCode(
ID_CatNum Integer,
CatalogNum Integer,
PrdctName VarChar(50) NOT NULL,
DsgFrm VarChar(15),
Strength Real,
PRIMARY KEY (ID_CatNum),
CONSTRAINT PrdctUnique1 UNIQUE (ID_CatNum,CatalogNum),
CONSTRAINT PrdctUnique2 UNIQUE (CatalogNum,PrdctName,DsgFrm,Strength)
);
CREATE TABLE TradeDress(
ID_TradeDress Integer,
Concept_ID Integer,
RevisionNum Integer NOT NULL,
DateApproved VarChar(10),
Hyperlink VarChar(50),
PRIMARY KEY(ID_TradeDress),
CONSTRAINT ConceptRevUnique UNIQUE (Concept_ID,RevisionNum),
FOREIGN KEY(Concept_ID) REFERENCES ProductConcept (ID_Concept)
);
CREATE TABLE Employees(
employeeId Integer NOT NULL,
ssn VarChar(20),
name VarChar(25) NOT NULL,
phone VarChar(25),
employeeType VarChar(25),
jobType VarChar(25),
supervisorId Integer,
PRIMARY KEY (employeeId)
);
CREATE TABLET ProductConcept(
ID_Concept Integer NOT NULL,
ProductCode_ID Integer,
ConceptName VarChar(25) NOT NULL,
Description VarChar(150),
PRIMARY KEY(ID_Concept),
CONSTRAINT ConceptProductUnique UNIQUE (ProductCode_ID,ConceptName),
FOREIGN KEY(ProductCode_ID) REFERENCES ProductCode(ID_CatNum)
);
CREATE TABLE TabletTradeDress(
ID_TabletTD Integer,
TradeDress_ID Integer,
TabletShape VarChar(25),
TabletColor VarChar(25) NOT NULL,
FilmCoated Char(1) NOT NULL,
Bisected Char(1) NOT NULL,
Debossed Char(1) NOT NULL,
CONSTRAINT TabletTDUnique UNIQUE (TabletColor,FilmCoated,Bisected,Debossed),
FOREIGN KEY(TradeDress_ID) REFERENCES TradeDress(ID_TradeDress)
);
CREATE TABLE CapsuleTradeDress(
ID_CapsuleTD Integer,
TradeDress_ID Integer,
CapsuleColor_Top VarChar(25) NOT NULL,
CapsuleColor_Bottom VarChar(25) NOT NULL,
CapsuleSize VarChar(5) NOT NULL,
employeeID Integer,
PRIMARY KEY(ID_CapsuleTD),
CONSTRAINT CapsuleTDUnique UNIQUE (CapsuleColor_Top,CapsuleColor_Bottom,CapsuleSize),
FOREIGN KEY(employeeID) REFERENCES Employees(employeeID)
);
INSERT INTO ProductCode (ID_CatNum,CatalogNum,PrdctName,DsgFrm,Strength) VALUES(1,1523,'ProductA','Tablet',25);
INSERT INTO ProductCode (ID_CatNum,CatalogNum,PrdctName,DsgFrm,Strength) VALUES(2,1524,'ProductA','Tablet',125);
INSERT INTO ProductCode (ID_CatNum,CatalogNum,PrdctName,DsgFrm,Strength) VALUES(3,1525,'ProductA','Tablet',225);
INSERT INTO ProductCode (ID_CatNum,CatalogNum,PrdctName,DsgFrm,Strength) VALUES(4,5638,'ProductB','Capsule',37);
INSERT INTO ProductCode (ID_CatNum,CatalogNum,PrdctName,DsgFrm,Strength) VALUES(5,2453,'ProductC','Capsule',25);
INSERT INTO ProductConcept(ID_Concept,ProductCode_ID,ConceptName,Description) VALUES(1,1,'A01.1','5% film coating 7% HPMC');
INSERT INTO ProductConcept(ID_Concept,ProductCode_ID,ConceptName,Description) VALUES(2,1,'A01.2','7% film coating 7% HPMC');
INSERT INTO ProductConcept(ID_Concept,ProductCode_ID,ConceptName,Description) VALUES(3,1,'A01.3','5% film coating 3% HPMC');
INSERT INTO ProductConcept(ID_Concept,ProductCode_ID,ConceptName,Description) VALUES(4,4,'A01.1','9 to 1 minitab A to B');
INSERT INTO ProductConcept(ID_Concept,ProductCode_ID,ConceptName,Description) VALUES(5,4,'A01.2','8 to 2 minitab A to B');
NSERT INTO Employees (employeeId,ssn,name,phone,employeeType,jobType )
VALUES(1, '1234567890','John','555-123-1234','Manager','CEO');
INSERT INTO Employees (employeeId,ssn,name,phone,employeeType,jobType,supervisorId )
VALUES(2, '1234567890','Adrian','555-123-1234','Manager','CEO',1);
INSERT INTO Employees (employeeId,ssn,name,phone,employeeType,jobType,supervisorId )
VALUES(3, '1234567890','Jane','555-123-1234','Manager','CFO',1);
INSERT INTO TradeDress (ID_TradeDress,Concept_ID,DateApproved,RevisionNum) VALUES(1,1,'2010-02-04',1);
INSERT INTO TradeDress (ID_TradeDress,Concept_ID,DateApproved,RevisionNum) VALUES(2,1,'2010-05-06',2);
INSERT INTO TradeDress (ID_TradeDress,Concept_ID,DateApproved,RevisionNum) VALUES(3,2,'2010-06-08',1);
INSERT INTO TradeDress (ID_TradeDress,Concept_ID,DateApproved,RevisionNum) VALUES(4,3,'2010-01-31',1);
INSERT INTO TradeDress (ID_TradeDress,Concept_ID,DateApproved,RevisionNum) VALUES(5,3,'2010-04-20',2);
INSERT INTO TradeDress (ID_TradeDress,Concept_ID,DateApproved,RevisionNum) VALUES(6,4,'2010-04-20',1);
INSERT INTO TabletTradeDress (ID_TabletTD,TradeDress_ID,TabletShape,TabletColor,FilmCoated,Bisected,Debossed)
VALUES(1,1,'capsule-shaped','orange','y','n','y');
INSERT INTO TabletTradeDress (ID_TabletTD,TradeDress_ID,TabletShape,TabletColor,FilmCoated,Bisected,Debossed)
VALUES(2,2,'capsule-shaped','orange','y','y','n');
INSERT INTO TabletTradeDress (ID_TabletTD,TradeDress_ID,TabletShape,TabletColor,FilmCoated,Bisected,Debossed)
VALUES(3,3,'capsule-shaped','pink','y','y','n');
INSERT INTO TabletTradeDress (ID_TabletTD,TradeDress_ID,TabletShape,TabletColor,FilmCoated,Bisected,Debossed)
VALUES(4,4,'capsule-shaped','none','n','y','n');
INSERT INTO TabletTradeDress (ID_TabletTD,TradeDress_ID,TabletShape,TabletColor,FilmCoated,Bisected,Debossed)
VALUES(5,5,'capsule-shaped','purple','y','y','n');
INSERT INTO CapsuleTradeDress (ID_CapsuleTD,TradeDress_ID,CapsuleColor_Top,CapsuleColor_Bottom,CapsuleSize, employeeId)
VALUES(1,6,'yellow','white','00',1);
INSERT INTO CapsuleTradeDress (ID_CapsuleTD,TradeDress_ID,CapsuleColor_Top,CapsuleColor_Bottom,CapsuleSize, employeeId)
VALUES(2,7,'blue','purple','00',2);
INSERT INTO CapsuleTradeDress (ID_CapsuleTD,TradeDress_ID,CapsuleColor_Top,CapsuleColor_Bottom,CapsuleSize, employeeId)
VALUES(3,8,'orange','orange','01',2);
INSERT INTO CapsuleTradeDress (ID_CapsuleTD,TradeDress_ID,CapsuleColor_Top,CapsuleColor_Bottom,CapsuleSize, employeeId)
VALUES(4,9,'purple','purple','01',3);
INSERT INTO CapsuleTradeDress (ID_CapsuleTD,TradeDress_ID,CapsuleColor_Top,CapsuleColor_Bottom,CapsuleSize, employeeId)
VALUES(5,10,'pink','pink','01',4);
INSERT INTO CapsuleTradeDress (ID_CapsuleTD,TradeDress_ID,CapsuleColor_Top,CapsuleColor_Bottom,CapsuleSize, employeeId)
VALUES(6,11,'yellow','orange','02',1);
1.Please analyze the relational schema and update it if you found missing constraints.
2.Show latest revision of all tablet products that are bisected and NOT debossed
3.Display productname, strength and concept name and rev num for all concepts of tablet products that are green or pink
ID_CatNum Integer,
CatalogNum Integer,
PrdctName VarChar(50) NOT NULL,
DsgFrm VarChar(15),
Strength Real,
PRIMARY KEY (ID_CatNum),
CONSTRAINT PrdctUnique1 UNIQUE (ID_CatNum,CatalogNum),
CONSTRAINT PrdctUnique2 UNIQUE (CatalogNum,PrdctName,DsgFrm,Strength)
);
CREATE TABLE TradeDress(
ID_TradeDress Integer,
Concept_ID Integer,
RevisionNum Integer NOT NULL,
DateApproved VarChar(10),
Hyperlink VarChar(50),
PRIMARY KEY(ID_TradeDress),
CONSTRAINT ConceptRevUnique UNIQUE (Concept_ID,RevisionNum),
FOREIGN KEY(Concept_ID) REFERENCES ProductConcept (ID_Concept)
);
CREATE TABLE Employees(
employeeId Integer NOT NULL,
ssn VarChar(20),
name VarChar(25) NOT NULL,
phone VarChar(25),
employeeType VarChar(25),
jobType VarChar(25),
supervisorId Integer,
PRIMARY KEY (employeeId)
);
CREATE TABLET ProductConcept(
ID_Concept Integer NOT NULL,
ProductCode_ID Integer,
ConceptName VarChar(25) NOT NULL,
Description VarChar(150),
PRIMARY KEY(ID_Concept),
CONSTRAINT ConceptProductUnique UNIQUE (ProductCode_ID,ConceptName),
FOREIGN KEY(ProductCode_ID) REFERENCES ProductCode(ID_CatNum)
);
CREATE TABLE TabletTradeDress(
ID_TabletTD Integer,
TradeDress_ID Integer,
TabletShape VarChar(25),
TabletColor VarChar(25) NOT NULL,
FilmCoated Char(1) NOT NULL,
Bisected Char(1) NOT NULL,
Debossed Char(1) NOT NULL,
CONSTRAINT TabletTDUnique UNIQUE (TabletColor,FilmCoated,Bisected,Debossed),
FOREIGN KEY(TradeDress_ID) REFERENCES TradeDress(ID_TradeDress)
);
CREATE TABLE CapsuleTradeDress(
ID_CapsuleTD Integer,
TradeDress_ID Integer,
CapsuleColor_Top VarChar(25) NOT NULL,
CapsuleColor_Bottom VarChar(25) NOT NULL,
CapsuleSize VarChar(5) NOT NULL,
employeeID Integer,
PRIMARY KEY(ID_CapsuleTD),
CONSTRAINT CapsuleTDUnique UNIQUE (CapsuleColor_Top,CapsuleColor_Bottom,CapsuleSize),
FOREIGN KEY(employeeID) REFERENCES Employees(employeeID)
);
INSERT INTO ProductCode (ID_CatNum,CatalogNum,PrdctName,DsgFrm,Strength) VALUES(1,1523,'ProductA','Tablet',25);
INSERT INTO ProductCode (ID_CatNum,CatalogNum,PrdctName,DsgFrm,Strength) VALUES(2,1524,'ProductA','Tablet',125);
INSERT INTO ProductCode (ID_CatNum,CatalogNum,PrdctName,DsgFrm,Strength) VALUES(3,1525,'ProductA','Tablet',225);
INSERT INTO ProductCode (ID_CatNum,CatalogNum,PrdctName,DsgFrm,Strength) VALUES(4,5638,'ProductB','Capsule',37);
INSERT INTO ProductCode (ID_CatNum,CatalogNum,PrdctName,DsgFrm,Strength) VALUES(5,2453,'ProductC','Capsule',25);
INSERT INTO ProductConcept(ID_Concept,ProductCode_ID,ConceptName,Description) VALUES(1,1,'A01.1','5% film coating 7% HPMC');
INSERT INTO ProductConcept(ID_Concept,ProductCode_ID,ConceptName,Description) VALUES(2,1,'A01.2','7% film coating 7% HPMC');
INSERT INTO ProductConcept(ID_Concept,ProductCode_ID,ConceptName,Description) VALUES(3,1,'A01.3','5% film coating 3% HPMC');
INSERT INTO ProductConcept(ID_Concept,ProductCode_ID,ConceptName,Description) VALUES(4,4,'A01.1','9 to 1 minitab A to B');
INSERT INTO ProductConcept(ID_Concept,ProductCode_ID,ConceptName,Description) VALUES(5,4,'A01.2','8 to 2 minitab A to B');
NSERT INTO Employees (employeeId,ssn,name,phone,employeeType,jobType )
VALUES(1, '1234567890','John','555-123-1234','Manager','CEO');
INSERT INTO Employees (employeeId,ssn,name,phone,employeeType,jobType,supervisorId )
VALUES(2, '1234567890','Adrian','555-123-1234','Manager','CEO',1);
INSERT INTO Employees (employeeId,ssn,name,phone,employeeType,jobType,supervisorId )
VALUES(3, '1234567890','Jane','555-123-1234','Manager','CFO',1);
INSERT INTO TradeDress (ID_TradeDress,Concept_ID,DateApproved,RevisionNum) VALUES(1,1,'2010-02-04',1);
INSERT INTO TradeDress (ID_TradeDress,Concept_ID,DateApproved,RevisionNum) VALUES(2,1,'2010-05-06',2);
INSERT INTO TradeDress (ID_TradeDress,Concept_ID,DateApproved,RevisionNum) VALUES(3,2,'2010-06-08',1);
INSERT INTO TradeDress (ID_TradeDress,Concept_ID,DateApproved,RevisionNum) VALUES(4,3,'2010-01-31',1);
INSERT INTO TradeDress (ID_TradeDress,Concept_ID,DateApproved,RevisionNum) VALUES(5,3,'2010-04-20',2);
INSERT INTO TradeDress (ID_TradeDress,Concept_ID,DateApproved,RevisionNum) VALUES(6,4,'2010-04-20',1);
INSERT INTO TabletTradeDress (ID_TabletTD,TradeDress_ID,TabletShape,TabletColor,FilmCoated,Bisected,Debossed)
VALUES(1,1,'capsule-shaped','orange','y','n','y');
INSERT INTO TabletTradeDress (ID_TabletTD,TradeDress_ID,TabletShape,TabletColor,FilmCoated,Bisected,Debossed)
VALUES(2,2,'capsule-shaped','orange','y','y','n');
INSERT INTO TabletTradeDress (ID_TabletTD,TradeDress_ID,TabletShape,TabletColor,FilmCoated,Bisected,Debossed)
VALUES(3,3,'capsule-shaped','pink','y','y','n');
INSERT INTO TabletTradeDress (ID_TabletTD,TradeDress_ID,TabletShape,TabletColor,FilmCoated,Bisected,Debossed)
VALUES(4,4,'capsule-shaped','none','n','y','n');
INSERT INTO TabletTradeDress (ID_TabletTD,TradeDress_ID,TabletShape,TabletColor,FilmCoated,Bisected,Debossed)
VALUES(5,5,'capsule-shaped','purple','y','y','n');
INSERT INTO CapsuleTradeDress (ID_CapsuleTD,TradeDress_ID,CapsuleColor_Top,CapsuleColor_Bottom,CapsuleSize, employeeId)
VALUES(1,6,'yellow','white','00',1);
INSERT INTO CapsuleTradeDress (ID_CapsuleTD,TradeDress_ID,CapsuleColor_Top,CapsuleColor_Bottom,CapsuleSize, employeeId)
VALUES(2,7,'blue','purple','00',2);
INSERT INTO CapsuleTradeDress (ID_CapsuleTD,TradeDress_ID,CapsuleColor_Top,CapsuleColor_Bottom,CapsuleSize, employeeId)
VALUES(3,8,'orange','orange','01',2);
INSERT INTO CapsuleTradeDress (ID_CapsuleTD,TradeDress_ID,CapsuleColor_Top,CapsuleColor_Bottom,CapsuleSize, employeeId)
VALUES(4,9,'purple','purple','01',3);
INSERT INTO CapsuleTradeDress (ID_CapsuleTD,TradeDress_ID,CapsuleColor_Top,CapsuleColor_Bottom,CapsuleSize, employeeId)
VALUES(5,10,'pink','pink','01',4);
INSERT INTO CapsuleTradeDress (ID_CapsuleTD,TradeDress_ID,CapsuleColor_Top,CapsuleColor_Bottom,CapsuleSize, employeeId)
VALUES(6,11,'yellow','orange','02',1);
1.Please analyze the relational schema and update it if you found missing constraints.
2.Show latest revision of all tablet products that are bisected and NOT debossed
3.Display productname, strength and concept name and rev num for all concepts of tablet products that are green or pink
Answers
3.select p1.PrdctName,p1.Strength,p2.ConceptName,r.RevisionNum from ProductCode p1,ProductConcept p2,TradeDress rUNION ALL
selectTabletColor from TabletTradeDress WHERE TabletColor ='green' OR 'pink'
Similar Solved Questions
1 answers
Help #2, 3, 4 Calculate the area of the region. Round your final answer to 3...
help #2, 3, 4 Calculate the area of the region. Round your final answer to 3 decimal places. The region inside both of these graphs: r = 3sin @ and r = 3cos e 0.6421 X 3. [0/1 Points] DETAILS PREVIOUS ANSWERS Calculate the area of the region. Round your final answer to 3 decimal places. The regi...
1 answers
Point charges, separated by 10 cm, What is the magnitude of the che valus of +20...
point charges, separated by 10 cm, What is the magnitude of the che valus of +20 and 40Co respectively mutual foce betwen them o c 2. Two point charges are 2m apart and have charges of +2.00 and-2.00 Colombe,apetively Wh isthe magnitude of electric field at a polat midway between the two chargn? (k-...
1 answers
Client has UTI (primary focus), sepsis, urinary retention, hypertension, diabetic and on DIALYSIS. Patient have a...
Client has UTI (primary focus), sepsis, urinary retention, hypertension, diabetic and on DIALYSIS. Patient have a history of alcoholic liver cirrhosis and smoking. Labs (creatinine and bun is high, sodium,calcium, eGFR are low as well as protein and albumin) what would be a good... S...
1 answers
DNA is made up of phosphate groups, nitrogen bases, and what?
DNA is made up of phosphate groups, nitrogen bases, and what?...
1 answers
Jason leaves Detroit at 9:00 PM and drives at a constant speed west along I-94. He...
Jason leaves Detroit at 9:00 PM and drives at a constant speed west along I-94. He passes Ann Arbor, 40 mi from Detroit, at 9:48 PM. (a) Express the distance d traveled in terms of the time t (in hours) elapsed. d(t) (b) Draw the graph of the equation in part (a) d 100 100H 90 90 80 80 70 70 60 60 5...
1 answers
Compute the multifactor productivity measure for each of the weeks shown for production of chocolate bars....
Compute the multifactor productivity measure for each of the weeks shown for production of chocolate bars. Assume 40-hour weeks and an hourly wage of $16. Overhead is 1.5 times weekly labor cost. Material cost is $9 per pound. (Round your answers to 2 decimal places.) Week Output (units) 26,000 31,0...
1 answers
A bowling ball rolls up a ramp 0.38 m high without slipping to storage. It has...
A bowling ball rolls up a ramp 0.38 m high without slipping to storage. It has an initial velocity of its center of mass of 3.6 m/s. (a) What is its velocity at the top of the ramp (in m/s)?...
1 answers
Multiple Choice Question 36 Which of the following is not a characteristic of an effective product...
Multiple Choice Question 36 Which of the following is not a characteristic of an effective product design process? O matches product characteristics with customer requirements O reduces the time required to design a new product or service o maximizes the revisions necessary to make a design workable...
1 answers
Question 1 (3.333 points) Since the 1990's... O Algorithmic and high-frequency trading have been increasing, and...
Question 1 (3.333 points) Since the 1990's... O Algorithmic and high-frequency trading have been increasing, and bid-ask spreads have been increasing the percentage of trades in NYSE-listed stocks that occur on a separate exchange has increased, and algorithmic and high-frequency trading have be...
1 answers
Step 2 of 5: Calculate the estimated variance of errors, s2e. Round your answer to three...
Step 2 of 5: Calculate the estimated variance of errors, s2e. Round your answer to three decimal places. Step 3 of 5: Calculate the estimated variance of slope, s2b1. Round your answer to three decimal places. Step 4 of 5: Construct the 90% confidence interval for the slope. Round your answers to th...
1 answers
The classic five-stage pipeline MIPS architecture is used to execute the code fragments in this problem....
The classic five-stage pipeline MIPS architecture is used to execute the code fragments in this problem. Assume the followings: • The architecture fully supports forwarding, • Register write is done in the first half of the clock cycle; register read is performed in the second half of the ...
1 answers
Suppose that people who study very hard for the BAR Exam have an odds of 1.2...
Suppose that people who study very hard for the BAR Exam have an odds of 1.2 of passing the BAR Exam. Suppose that people who do not study for the BAR Exam have an odds of .34 of passing the BAR Exam. What is the Relative Risk for failing the BAR Exam comparing people who did not study to people who...
1 answers
A chemist trying to measure the enthalpy change for the following hydrogenation reaction: Na2CO3. (S) ⟶Na2CO3...
A chemist trying to measure the enthalpy change for the following hydrogenation reaction: Na2CO3. (S) ⟶Na2CO3 ∙ 10H2O (s) Calibration of a calorimeter to give 357,9J raises the temperature 1.00 K. When 2,500 g of Na 2 CO 3 (s) was dissolved in 100.00 cm3 of water, the temperature rose t...
1 answers
In Java (The Person, Student, Employee, Faculty, and Staff classes) Design a class named Person and...
In Java (The Person, Student, Employee, Faculty, and Staff classes) Design a class named Person and its two derived classes named Student and Employee. Make Faculty and Staff derived classes of Employee. A person has a name, address, phone number, and e-mail address. A student has a class status (fr...
1 answers
Why is the peptide bond is considered rigid and planar? Please explain.
Why is the peptide bond is considered rigid and planar? Please explain....
1 answers
Find all x, -4pi < x < 6pi, such that [cos(x/3)]^4 + [sin(x/3)]^4 = 1 PLEASEEE HELPP
Find all x, -4pi < x < 6pi, such that [cos(x/3)]^4 + [sin(x/3)]^4 = 1PLEASEEE HELPP! :(...
1 answers
Problem 2-44A Tombert Company is a manufacturer of computers. Its controller resigned in October 2016. An...
Problem 2-44A Tombert Company is a manufacturer of computers. Its controller resigned in October 2016. An inexperienced assistant accountant has prepared the following income statement for the month of October 2016. TOMBERT COMPANY Income Statement For the Month Ended October 31, 2016 Sales (ne...