Tech Point Fundamentals

Tuesday, August 31, 2021

SQL Unique Key Constraint Interview Questions

SQL Unique Key Constraint Interview Questions and Answers


In SQL Unique Key is a value that is unique for every record of the column in a table.  The main job of the Unique Key is to allows you to place additional unique conditions on your columns. The Unique Keys are not stored within the index, they are stored separately. Normally the Unique Key creates the Non-Clustered Index by default. A table can have more than one Unique Key.

Please visit our Youtube Channel for more SQL Interview Questions and Answers videos by the below link:

Below are some common interview questions based on the SQL Unique Key Constraint:

QA. What is the difference between PRIMARY KEY and UNIQUE KEY?

Please watch the Primary Key video here for more details.

QB. What is the difference between UNIQUE  KEY and FOREIGN KEY?

Please watch the Foreign Key video here for more details.

QC. What is the difference between UNIQUE KEY and UNIQUE INDEX?

Q01. What is the difference between UNIQUE Constraint and UNIQUE INDEX in SQL?

Q02. If the Primary Key uniquely identified rows, then why bother about UNIQUE KEY?

Q03. Is NULL value allowed in the UNIQUE KEY column?

Q04. Can a UNIQUE KEY contain an empty(blank) value or whitespace?

Q05. Can you make the UNIQUE KEY column an identity column?

Q06. Can you create a UNIQUE KEY Constraint on a PRIMARY KEY column?

Q07. Which type of index is created by default for the UNIQUE KEY Constraint?

Q08. If you DROP the UNIQUE Constraint, does it also drop the UNIQUE Index?

Q09. Can you add Clustered Unique Index in any table? or Can a Unique Constraint ever be Clustered Index in SQL?

Q10. Can you use UNIQUE KEY as a replacement for PRIMARY KEY?

Q11. Is it mandatory for a UNIQUE KEY to being a Non-Clustered Index? Can a UNIQUE Key be created on Clustered Index?

Q12. Can you add the UNIQUE KEY Constraint on a column that contains data already?

Q13. Can you update or delete the UNIQUE KEY value of a table that is referenced by the foreign key?

Q14. Can you make a varchar(max) column as UNIQUE KEY in SQL?

Q15. If you have to store the data in such a way that each and every record can be identified by a unique value. What will be your approach PRIMARY KEY or Unique Key?

Q16. If a NULL value never equals another NULL value, it means they are unique, then why only one NULL value is allowed in a UNIQUE key column?

Live Demo

Watch our related videos here

Recommended Articles

Most Frequently Asked SQL Interview Questions
Most Frequently Asked C# Interview Questions
Primary Key Interview Questions
Derived Table (DT) Interview Questions
Unicode vs Non-Unicode Data Types Interview Questions
Table Variable (TV) Interview Questions
Table-Valued Type (TVT) Interview Questions
Common Table Expression(CTE) Interview Questions
Temp Table Interview Questions
Static Class Interview Questions and Answers
Sealed Class Interview Questions and Answers
Sealed Method Interview Questions and Answers
Abstract Class vs Interface
Interface Interview Questions and Answers

Thanks for visiting this page. Please follow us on Twitter, Facebook, LinkedIn, Telegram, WhatsApp, Youtube, and Quora for regular updates.

No comments:

Post a Comment

Please do not enter any HTML. JavaScript or spam link in the comment box.