3.7 Databases real Flashcards
What is a flat file database
A flat file database stores a single table of data inside a single text file
How are flat file databases recorded (3)
Flat file databases are often stored using a CSV (comma separated values) format
Each record appears on a separate line
Each field is separated by a comma
Ease of flat file database?
This format is very easy to set up, however, it is hard to manage for anything but the simplest of data sets
Create a design for a flat file database that will store a contact book with names and mobile telephone numbers
For each field name, include the data type required
Create two lines of a CSV file with sample data
.
Primary key define
A primary key is a field that stores unique data for each record in a table
Label parts of flat file database
.
What can be used as a primary key? And its data type
An ID number can be introduced that is unique for each record
The data type will be an int or autonumber
.
Flat file database issues (2)
Flat files mean that we often have to repeat data in each record.
This leads to inconsistencies in the data – these make it hard to search or sort the data
This also causes redundant data – so the database uses more memory or storage than it needs to, it may also take longer to search
Table-
Record-
Field-
Primary key-
Table – stores records and fields in an organised manner
Record – an individual collection of data for one person/object, a row in a table
Field – one item of data, a column in a table
Primary key – field containing unique values for all records
Integer-
Real-
Date,time,datetime-
Char-
Varchar-
Text-
Integer (whole number)
Real, Float, Decimal (number with a decimal component)
Date, Time, Datetime (to store a dates and times)
Char (fixed length string up to 8,000 characters)
Varchar (variable length string up to 8,000 characters)
Text (variable length string up to 2 GB of data)
What is a relational database (3)
A relational database contains multiple tables
These tables will have links known as relationships
Each table is also known as a relation
Why are relational databases good
Relational databases allow us to design tables that reduce inconsistencies and eliminate data redundancy
Primary key?
A primary key is a field, where every value stored in it will be unique
Foreign key?
A foreign key is a field in a table that references the primary key of another table
3 different relationships between tables
.