Understanding Databases
What a database is
A database is an organised collection of related data stored so that it can be retrieved, updated and reported on efficiently. In a relational database the data lives in tables, each table holds one kind of thing (customers, orders, products), and each table is made of records (rows) and fields (columns). A field has a defined data type - text, number, currency, date/time, yes/no, and so on - and choosing the right type is a core skill: storing a price as text prevents arithmetic, and storing a date as text breaks sorting and date filters.
Keys and relationships
A primary key uniquely identifies each record in its table; it cannot be blank (no nulls) and cannot repeat. A foreign key is a field in one table that refers to the primary key of another, and it is what links tables together. Relationships are typically one-to-many (one customer has many orders) or one-to-one; a true many-to-many needs a junction table. Referential integrity stops you creating an order for a customer who does not exist, or deleting a customer who still has orders.
Objects in the file
The database file is more than tables. Queries ask questions of the data, forms provide a friendly screen for entering or viewing one record at a time, and reports present data for printing. A flat file vs relational distinction is a common exam idea: a single large table repeats data and invites inconsistency, whereas related tables store each fact once.
Traps and a rule of thumb
Watch for questions that confuse a field with a record, or that claim a primary key may contain duplicates or blanks. Another trap: assuming a query stores data - it stores a definition, not copies. Rule of thumb: one fact, one place - if you would have to type the same customer address into many rows, the design needs a second table and a relationship.
Worked example
A library lends books. A single table repeating borrower names on every loan row risks typos. Split into Members (MemberID primary key) and Loans (LoanID primary key, MemberID foreign key): one member, many loans - a one-to-many relationship enforcing referential integrity.