1.3.2 databases Flashcards
What is database?
database is an organised collection of data that can be accessed, managed and updated easily.
field
single piece of data in a record
record
a group of related fields
table
collection of records
primary key
a unique identifier for each record in a table
foreign key
is an attribute that links two tables together. It acts as the primary key in one table and as the foreign key in the other.
secondary key
used to search for data in a database
relational database
a type of database that organises data in multiple tables.
it uses a primary key to link tables together and reduce data redundancy.
making efficient use of storage.
what is referential integrity?
- it ensures consistency between related tables in a rational database.
- maintain a valid relationship between the primary key and foreign key.
- a foreign key must only exist if a corresponding primary key is in the related/linked table.
benefits and drawbacks of referential integrity.
benefits:
- ensure data consistency and accuracy.
- prevent orphaned records
drawbacks:
- can impact the performance as more checks need to be done (to ensure consistency)
- may require additional planning and designing.
how to maintain referential integrity:
- use a DBMS with a built-in support.
- regular checkups and clean data to ensure inconsistency.