Accenture Interview Questions | If a emp table is having duplicate emp_id then can we make it primary key?

Question

Primary Key

in progress 0
TheDataMonk 55 years 4 Answers 1150 views Grand Master 0

Answers ( 4 )

  1. No a primary key should always be unique and non-null. Since in this table emp_id is containing duplicate values we cannot make it as a primary key of the table. Either we should remove the duplicate using the ACID property of RDBMS or use a combination of any other field with emp_id to make it unique and then make it the primary key of the table

  2. No, we cannot make empid as primary key. By the definition of primary key, a primary key is one which is able to uniquely identify each tuple of the table. As the table contains dupilicate values of empid, so it cannot be made primary key.

  3. No, we cannot make Empid as PRIMARY KEY because PRIMARY KEY has to be UNIQUE and don’t contain any NULL values.
    As the Column Empid contains Duplicate values, It cannot be treated as the PRIMARY KEY.

  4. Primary key should have distinct and non null values. If emp ID has duplicate values it cannot act as a primary key but combination of columns with emp ID which makes the row have unique identifier can act as primary key (combination of columns)

Leave an answer

Browse
Browse