3.2.1 Databases 1 Flashcards
what is a database
organised collection of data
databases consist of…
entities-tables
relationships between entities- created using key fields
two types of database
flat file
relational
flat file databases
only consist of one file/ table
run onto problems when try to store data about related items eg contacts phone numbers addresses
does not have integrity- cannot reply on information
relational databases
store data about separate entities (contacts and companies) in different tables.
more than one table joined by relationships using primary and foreign keys
advantages of a relational database
data redundancy reduced- data duplication- cut down on data items.
data inconsistency reduced- inconsistency by product of redundancy.
data integrity- inconsistency reduced- more integrity- integrity result of validation.
access rights-relational db systems allow for different users to be given different rights to data operations. SELECT INSERT DELETE ALTER CREATE
an entity
object about which data is stored. each instance of an entity is a record- information about one specific employee or product etc.
attributes
describe each individual data item within the entity
primary key
uniquely identifies each instance of an entity
composite key
uniquely identifies a record using two or more attributes which may be primary keys in other entities.
foreign key
a non key field in one table which is the key field in another table. used to create the relationship between the entities.
relationship
a link between two entities. cardinality details the number of occurrences that can be involved in a relationship.
1:1 1 record in 1 table relates to only 1 in another- teachers to rooms in a primary school.
1:M 1 order contains many items.
M:N many pupils study many subjects. - Broken down to 1:M in dbases.
referential integrity
ensures that the data in one table does not contradict the data in another table.
every foreign key value which exists in a table must have a matching primary key value in a related table.
used to manage the relationships between primary and foreign keys.
LOOK AT NOTES FOR INSTRUCTION.