8 - data bases Flashcards
database
structured collection of items of data that can be accessed by different applications programs
table
group of similar data withe rows and columns
record
a row - one instance if an entity (tuple)
tuple
a row - one instance if an entity (record)
field
column - data item stored for an entity eg name (attribute)
entity
anything that can have data stored about it eg person place thing
attribute
column - data item stored for an entity eg name (field)
cadidate key
the smallest number of attributes where no row has the same value (all unique)
primary key
unique identifier of a table
secondary key
alternative to the primary key
foreign key
set of attributes that refer to another tables primary key
relationship
one table in a database has a foreign key that refers to a primary key in another table in the database
1:1
1:m
m:1
m:m
(the many always has the foreign key)
referential integrity
database doesn’t contain any values of foreign key that don’t match the corresponding primary key
index
a data structure built from one or more columns in a database table to speed up searching
ER diagram
a graphical representation of a database and the relationships between
normalisation
the process of organising data to be stored in a database into 2 or more tables and relationships between the tables (redundancy is reduces)
1NF
- data is atomic - cant be split further
- no repeating attributes
- each table has a primary key
- each field name is unique
2NF
- must be 1NF
- remove partial key dependencies - where an attribute in a table depends on only a part of the primary key not the whole key
3NF
- already in 2NF
- remove transitive dependencies - where non key attribute depends on another non key attribute
composite key
set of attributes that form a primary key to provide a unique identifier for a table
limitations of file based approach
- redundancy - storage space wasted when data is duplicated by separate applications
- inconsistency - data is altered by one application and not another
- dependencies - enquires can depend on the structure of data and software used
+ of relational databases
+ no redundancy - storage space not wasted as data only stored once
+ no inconsistencies - data altered in one app is available in another
+ independent - enquires arent dependent on the structure of the data and software
DBMS
system software for the definition, creation and manipulation of a database
how DBMS fixes file based approach
- redundancy - data is stored in separate tables - flags errors when keys are deleted or data is repeated
- inconsistency - stores most items once - allowing updates to be seen by all apps
- dependency - each app only has access to what it requires - DBMS has facilities to query data