Practice Discrete Math

Relations / Sql Keys Constraints

Least You Need to Know: Keys, Functional Dependencies, and Constraints

Database design questions are relation questions wearing engineering clothes. Keys identify tuples, foreign keys connect relations, and functional dependencies explain when one set of attributes determines another.

جو کم از کم جاننا ضروری ہے

اہم علامتیں

X → Y attribute set X functionally determines attribute set Y
PK primary key
FK foreign key referencing another relation's key

مختصر حل شدہ مثال

  • In `Employees(employee_id, email, team_id, team_name)`, the attribute `employee_id` may identify each row uniquely.
  • If `team_id` always determines `team_name`, then `team_id → team_name` is a functional dependency.
  • Repeating `team_name` in every employee row can create update anomalies if the team name changes.
  • Splitting team facts into a separate `Teams(team_id, team_name)` relation removes that repetition.

عام غلطیاں

اس قسم کے سوال کو کیسے پہچانیں

Next recommended lesson

Try Least You Need to Know: Relations in Databases and State Machines next for a nearby refresher.

Least You Need to Know: Relations in Databases and State Machines

Related lessons

Keep going with nearby lessons in the same topic.

More ways to explore

مشق شروع کریں