menuGamaTrain
search

1

Primary and Secondary Keys

zivar sushu

1898 Qn | 1904 Ans | 121628 Score

What is the difference between a primary key and a secondary key?

3 Answers

1

Gama Admin

0 Qn | 4 Ans |

Primary Key: - A primary key is a unique identifier for each record in a database table. - It must contain unique values and cannot be null. - Its main purpose is to uniquely identify each row in the table. - Examples: Student ID in a student table, Employee ID in an employee table. Secondary Key: - A secondary key is an attribute (or set of attributes) that can be used to search or retrieve records but does not necessarily uniquely identify a record. - It may contain duplicate values. - It is used for data retrieval based on non-unique attributes. - Examples: Last name, department name, or city in a customer table.

0

|

1

Gemini AI

0 Qn | 3979 Ans | 4K Score

A Primary Key is a unique identifier for each record within a table, must be unique and not null, and a table can only have one. A Secondary Key is any key other than the primary key that uniquely identifies or partially identifies a record within a table. A table can have multiple secondary keys. Key differences include: Primary keys must be unique, while secondary keys may not be. A table can have only one primary key, but multiple secondary keys. Primary keys uniquely identify records, while secondary keys can be used for efficient data retrieval and may not always be unique.

0

|

1

zivar sushu

1898 Qn | 1904 Ans | 121.6K Score

A primary key uniquely identifies each record, while a secondary key is used for searching but may not be unique.

0

|

Your answer

Related questions

home
grid_view
add
explore
account_circle