sql Flashcards
What is a flat-file database?
A database made up of one table
What is a relational database?
A database containing more than one table
What is an entity?
a collection of all related records
What is a primary key?
a unique value in a table e.g. teacher_ID
What is a secondary key?
data that can be used for a specific search e.g.teacher_name
What is a foreign key?
a field that references the primary key of another table
What are the 3 types of relationships?
one-to-one
one-to-many
many-to-many
Why is a many-to-many relationship a potential problem?
it will be difficult to reassemble the data
How do you select all the data from a table?
SELECT*
FROM table_name
How do you select specific data from a table?
SELECT attribute1, attribute2
FROM table_name
How do you select data depending on the value of an attribute?
SELECT*
FROM table_name
WHERE attribute=value
How do you order data by ascending order?
SELECT*
FROM table_name
ORDER BY attribute ASC
How do you order data by descending order?
SELECT*
FROM table_name
ORDER BY attribute DESC
How do you select data from 2 tables?
SELECT table1_attribute,
table2_attribute
FROM table1, table2
How do you select data and join 2 tables?
SELECT*
FROM table1, table2
WHERE
table1attribute+table2attribute
What are the advantages of a flat-file database?
all records stored in one place easy to understand easy to set up simple sorting of records simply view or extract records every day things like business contacts can be stored and used
What are the disadvantages of a flat-file database?
potential duplication non-unique records harder to update inefficient harder to change data format poor at complex queries poor at limiting access
What are the advantages of relation databases?
no multiple record changes needed more efficient simple to delete or modify details complex queries can be carried out better security cater for future requirements