PrepAway - Latest Free Exam Questions & Answers

What are the errors in the above query?

Remo works as a Database Designer for Tech Inc. He wants to create a table named Product. He issues the
following query to create the Product table:
CREATE Product (
ProductID Char (10) NOT NULL,
OrderID Char (10) NULL
ProductName Varchar NOT NULL,
Primary key (OrderID, ProductID))
What are the errors in the above query?
Each correct answer represents a complete solution.Choose two.

PrepAway - Latest Free Exam Questions & Answers

A.
An attribute declared as a primary key cannot contain NULL values.

B.
Each attribute should be defined as a primary keyseparately.

C.
A table cannot have two primary keys.

D.
ProductName is declared as Varchar without specifying the width of the column.

Explanation:
Answer D and AWhen a column is declared as Varchar, it is mandatory to declare the maximum width of the column. The
OrderID and ProductID columns are declared as the composite primary key attribute. Therefore, neither
ProductID nor OrderID can contain
NULL values, whereas in the declaration of OrderID,it is not specified as NOT NULL. Therefore, both answer
options D and A are responsible
for introducing errors in the query.

One Comment on “What are the errors in the above query?


Leave a Reply