Sql Interview Question
What is a primary key?
Answer
A PRIMARY KEY constraint is a unique identifier for a row within a database table. A primary key prevents, duplicates and ensures that all records have their own distinct values.
Primary keys don’t allow nulls, so you are guaranteed that each record has its own unique populated value.
Every table should have a primary key constraint to uniquely identify each row, and only one primary key constraint can be created for each table. The primary key constraints are used to enforce entity integrity.
It is not possible to change the length of a column defined with a PRIMARY KEY constraint. If you need to change the length then you must first delete the existing PRIMARY KEY constraint and then re-create it with the new definition.
Thanks for reading this article,
Next steps :
- Share this with your colleagues because Sharing is Learning
- Comment below if you need any assistance