


What Are Database Relationships?
In a relational database, data is stored across multiple tables. Instead of keeping all data in one large table, we split it into smaller, related tables to:
These relationships are shown using different line styles and symbols to visually represent how pieces of data are connected in a database.
In a database, a Primary Key and Foreign Key help organize data and create relationships between tables.'
What is a
Primary Key (PK) ?
A Primary key is a unique identifier for each row in a table.
Example: In a Students table, StudentID is the Primary Key because every student has a unique ID.
What is a
Foreign Key (FK) ?
A Foreign Key connects one table to another by referencing a Primary Key in a different table.
Example: In an Exams table, StudentID is a Foreign Key because it refers to a student in the Students table.

This diagram represents the relationship between STUDENTS and EXAMS in a database.
StudentID (PK): Unique identifier for each student.Name, Age, Department, GPA: Additional details about each student.ExamID (PK): Unique identifier for each exam attempt.StudentID (FK): References the StudentID from the STUDENTS table.CourseID (FK): Links the exam to a specific course.ExamDate, Score: Records the exam details.Contact
Donate
About
Privacy Policy
Changelog