Database Fundamentals — Question 101
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.)
Answer options
- A. An attribute declared as a primary key cannot contain NULL values.
- B. Each attribute should be defined as a primary key separately.
- C. A table cannot have two primary keys.
- D. ProductName is declared as Varchar without specifying the width of the column.
Correct answer: A, D
Explanation
Option A is correct because primary keys must contain unique and non-null values, making it invalid to have NULLs in a primary key. Option D is also correct since declaring ProductName as Varchar requires a specified width, which is missing. Options B and C are incorrect as they do not pertain to the errors present in the SQL command.