Knowee
Questions
Features
Study Tools

Consider the creation of the following table: Customer(CustId, AccountNo, CustName) with combination of columns Custid and AccountNo should be UNIQUE. Which one of the following options is CORRECT?Put UNIQUE constraint on both the columns separatelyThis type of constraint is not possiblePut PRIMARY KEY constraint on both the columns separatelyPut a table level UNIQUE constraint involving both the columns

Question

Consider the creation of the following table: Customer(CustId, AccountNo, CustName) with combination of columns Custid and AccountNo should be UNIQUE. Which one of the following options is CORRECT?Put UNIQUE constraint on both the columns separatelyThis type of constraint is not possiblePut PRIMARY KEY constraint on both the columns separatelyPut a table level UNIQUE constraint involving both the columns

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

The correct option is to "Put a table level UNIQUE constraint involving both the columns".

Here's why:

  1. Putting UNIQUE constraint on both the columns separately: This will ensure that each column individually has unique values, but it doesn't guarantee that the combination of CustId and AccountNo will be unique.

  2. This type of constraint is not possible: This is incorrect. SQL does allow for multi-column unique constraints.

  3. Put PRIMARY KEY constraint on both the columns separately: This is similar to the first option. It will ensure that each column individually has unique values, but it doesn't guarantee that the combination of CustId and AccountNo will be unique. Also, a table can have only one primary key.

  4. Put a table level UNIQUE constraint involving both the columns: This is the correct option. It ensures that the combination of CustId and AccountNo is unique across the table.

This problem has been solved

Similar Questions

Which of the following is NOT a type of SQL constraint? UNIQUEPRIMARY KEYALTERNATE KEYFOREIGN KEY

Which of the following is not a type of SQL constraint?Select one:a. UNIQUEb. DUPLICATEc. CHECKd. FOREIGN KEY

ct the correct answerWhat SQL statement is used to add a unique constraint to a column?OptionsUNIQUECHECKPRIMARY KEYCONSTRAINT

Which SQL constraint ensures that all values in a column are unique?OptionsDEFAULTUNIQUEPRIMARY KEYCHECK

Which constraint must a primary key adhere to

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.