A Primary Key (PK) is the unique fingerprint for every table row:
✔️ 100% Unique – No duplicate values allowed
✔️ Mandatory – Never NULL (unlike other columns)
✔️ Speeds Up Queries – Auto-creates an index
*Example:*
```sql
CREATE TABLE students (
student_id NUMBER PRIMARY KEY, -- ← PK!
name VARCHAR2(100)
);
```
💡 *Pro Tip:* Use `AUTO_INCREMENT` (or sequences) for hassle-free PKs!
🔔 *Follow* [@QueryHub]( / @queryhub ) for database design hacks!
#SQL #PrimaryKey #DatabaseDesign #QueryHub #DatabaseTutorials #LearnWithRaj #asklearnexcel
コメント