Relational Databases Flashcards

All 17 cards in this deck

What is a database?

A persistent, organised collection of structured data.

What is a relational database?

A database that stores data in more than one table, with the tables linked to each other by key fields (a primary key in one table used as a foreign key in another).

True or false? A relational database links several databases together.

False. It links several tables together within one database.

In a database, what is a table?

A collection of records about one kind of thing, e.g. customers, set out in rows and columns.

In a database table, what is a record?

All of the data stored about one item, e.g. one customer. It is one row of the table.

In a database table, what is a field?

One item of data stored about every record, e.g. Surname. It is one column of the table.

What is a primary key?

A field whose value uniquely identifies each record in a table, so no two records can have the same value.

What is a foreign key?

A field in one table that is the primary key of another table. It links the two tables together.

Why is a Surname field usually unsuitable as a primary key?

Two records could have the same surname, so it would not uniquely identify each record. An ID field, e.g. CustomerID, is added instead.

What does a field's data type set in a database table?

The kind of value every entry in that field can hold, e.g. integer, real, Boolean or string. A price field should be real, not integer or string.

What is data redundancy?

The same data being stored more than once, unnecessarily, e.g. a customer's address repeated on every one of their orders.

What is data inconsistency?

When the same data is stored in more than one place but the copies are not identical, e.g. an address changed in one record but not in the others.

How does a relational database reduce data redundancy?

Each item of data is stored once, in one table. Other tables refer to it using a foreign key instead of repeating it.

How does a relational database reduce data inconsistency?

Because each item of data is stored only once, a change is made in one place, so no out-of-date copies are left to disagree with it.

Can the same foreign key value appear in more than one record of a table?

Yes. A primary key value must be unique in its own table, but a foreign key value can repeat, e.g. one CustomerID on many records in an Order table, because one customer can place many orders.

What is a flat-file database?

A database that keeps all of its data in one single table. A relational database instead splits the data into several linked tables.

Apart from keeping data consistent, what is one other benefit of removing data redundancy?

The database takes up less storage space, because each item of data is stored once instead of being repeated.