Relational Database Concepts Flashcards
What is a table made up of?
Records
What are records made up of?
Fields
What are fields made up of?
Characters
Describe a table in a database.
Tables contain data such as students, orders, events, customers, suppliers, etc. A table is a data structure made up of rows and columns that contains data about the items.
What requirements must be met for the data structure to be called a table?
The table must have a unique name. Each field/column must have a unique name. Each record/row must be unique. Each data item within a field must contain only a single data item. The order of the records and fields does not matter.
Describe a record in a database.
A record is a single row within a table. It is a collection of data about a single item/event. A record might be about a customer, an order or an item, etc.
In a table, each record must be ______.
Unique
Describe a field in a database.
A field is an individual item within a record. Each field within a record should have a unique name. A field should only contain a single data item. Fields have individual data types and can have their own validation.
What is a primary key?
This is a field, in the table, that allows each record to be uniquely identified. Every value of the primary key must be unique.
What are the two types of primary key?
Simple or compound/composite.
What is a simple primary key?
One which is made up of a single field only, like ID.
What is a compound primary key?
One which combines more than one field to make a unique value.
An example of a compound primary key:
If we had a table showing a student, a date/time and if they are present - a student can only be in one place at a time. Therefore, combining the student name, data and period gives a unique value. These three fields could be combined to make a composite primary key.
What is a secondary key?
A secondary key is a field that is identified as being suitable for indexing the data. It is used to sort the data in a different order to the primary key. A table can have many secondary keys (every field could be a secondary key).
What is a foreign key?
A foreign key is used to link tables together. A foreign key is a field in one table that is linked to a primary key in another table.