Database structure
Tables, records, fields and keys.
Table — stores data in rows and columns. Record — one complete row (all data about one item). Field — one column (a single data item), with a defined data type.
Primary key — a field that UNIQUELY identifies each record (e.g., MemberID). It must be unique and never blank.
Foreign key — a field that links to the primary key of ANOTHER table, creating a relationship.
Example:
- Members table: MemberID (PK), Name, Email.
- Loans table: LoanID (PK), MemberID (FK → Members), BookID (FK → Books).
The foreign key MemberID in Loans links each loan to a member without repeating the member's details.