Relational Databases Flashcards
What is a database?
A database is a structured way to store data so that it can be retrieved using queries
What is the table?
The table is the structural format in which data is stored in a database
What is record?
A record is a row in a table. It is all the data stored as part of the same overarching value.
What is a field?
A field is a column in the table. These are the different categories storing values of different records
What are the data types?
Integer (Whole number)
Real (Number with decimal component)
Datetime (Stores dates and times)
Char (Fixed length string up to 8000)
Varchar (Variable length string up to 8000)
Text (Variable length string up to 2GB)
What is a primary key?
A primary key is a field that stores unique data for each record in a table.
How does a relational database eliminate data inconsistencies and redundancies?
A relational databases make use of multiple tables linked by relationships.
Using relational databases and multiple tables allows the elimination of data redundancy and reduces data inconsistencies
What is the purpose of the SELECT function?
Example?
SELECT… (list the fields to be displayed)
This function selects which field needs to be selected
SELECT MemberID, FirstName, Surname
FROM members
What is the purpose of the FROM function?
Example?
FROM… (specify the table name)
This function assigns the table in which data is selected from
SELECT MemberID, FirstName, Surname
FROM members
What is the purpose of the WHERE function?
Example?
WHERE… (list the search criteria)
This function is used to select on records that specify a condition
SELECT FirstName, Surname
FROM members
WHERE Town = ‘Ipswich’
What is the purpose of the ORDER function?
Example?
ORDER BY… (Order in which the data outputted is to be)
This function allows a query to sort data by ascending or descending order
SELECT *
FROM members
ORDER BY Surname ASC
How do you insert data into a table using SQL?
INSERT INTO (Table Name) (Fields)
VALUES (Value1, Value2)
How do you edit and delete data in a database using SQL?
UPDATE (Table Name)
SET (FieldName = Changed Value)
WHERE (Search Criteria)
DELETE FROM (Table Name)
WHERE (Search Criteria)
What are the issues with flat-file databases?
This leads to inconsistencies in the data making it hard to search and sort data.
Creates redundant data so the database uses more memory than needed