MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATABASE MANAGEMENT SYSTEM

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Consider attributes ID, CITY and NAME. which one of these can be considered as a primary key?
A
NAME
B
ID
C
CITY
D
ID, NAME
Explanation: 

Detailed explanation-1: -Detailed Solution. Here the ID is the only attribute that can be assumed as a primary key in this scenario. Other attributes are not valid choices.

Detailed explanation-2: -Which one of the following attribute can be taken as a primary key? Explanation: The attributes name, street and department can repeat for some tuples. But the id attribute has to be unique. So it forms a primary key.

Detailed explanation-3: -A primary key is a column–or a group of columns–in a table that uniquely identifies the rows of data in that table. For example, in the table below, CustomerNo, which displays the ID number assigned to different customers, is the primary key.

Detailed explanation-4: -The data type of a primary key should be a numeric, an integer or a short, fixed-width character. Uniqueness. A primary key must have a unique value, which implies that no other row in the table has the same value in the column.

Detailed explanation-5: -Explanation: The primary key is a single or combination of the field that identifies each record in a table uniquely. It cannot take a NULL value. A table can have only one primary key.

There is 1 question to complete.