Picture the admission desk of a district hospital on a busy morning. Two patients called Md. Karim arrive within an hour of each other, both with fever. One is sent to bed 12 of ward 3; the other goes home with medicine. That afternoon a blood report arrives labelled "Md. Karim, fever, 14 March". Whose file does it go into? A name cannot settle it, nor a disease, nor a date. The hospital needs one piece of information that can never belong to two patients. That piece of information is called a key, and this chapter is about keys and the rules that keep a table honest.
Question (49th BCS Written (Special); Subject Code: ICT-281; Exam: 10.10.2025): In a hospital, a patient file stores name, disease, date of admission, room number, bed number, as information. Which should be the primary key in this case?
a) Name
b) Date of admission
c) Disease
d) None of the above
Why it matters: This is one of the most steadily asked chapters in the recruitment papers. MCQs ask what a row is called, which key is the minimal super key and how many super keys a relation has. Written papers ask "primary key versus foreign key" (41st BCS, WZPGCL 2023), "find the super keys and candidate keys" (PGCB 2024), "the most appropriate primary key with justification" (Combined Bank 2026), "what is referential integrity?" (BPSC 2021) and "what is a dangling tuple?" (BPSC 2022).
By the end of this chapter you will be able to name every part of a relation in its formal and everyday words, tell a super key from a candidate key from a primary key, count super keys in your head, choose a primary key and defend the choice, state the integrity rules of the relational model with the reason behind each, write them into a CREATE TABLE statement, and predict exactly what a database does when a parent row with children is deleted or changed. The chapter has five parts; each one builds on the one before.