What is the difference between a primary key and a foreign key in a relational database?
- Data retrieval optimization
- Data validation and integrity constraints
- Table relationships and referential integrity
- Uniqueness and indexing
A primary key uniquely identifies each record in a table and ensures that there are no duplicate values. It also automatically creates a unique index for fast data retrieval. On the other hand, a foreign key establishes a relationship between two tables, ensuring referential integrity and enforcing data constraints.
Loading...
Related Quiz
- What is the purpose of VLANs (Virtual Local Area Networks) in network infrastructure?
- Explain the process of converting a relation into Third Normal Form (3NF) with an example.
- Which type of NoSQL database is best suited for handling highly interconnected data?
- Which entity has its own address space in memory: process or thread?
- How does the Shortest Job First (SJF) scheduling algorithm minimize average waiting time?