Databases Flashcards
What is a Primary Key?
An attribute that provides a unique identifier for each entity in a database table
What is a Foreign Key?
An attribute in a table which is a primary key in another table
How do you create a many to many database?
A new table called a link table is created - which contains multiple foreign keys
What are the benefits of a normalised database?
1) More efficient to search through and sort as tables are split into much smaller tables
2) Easier to maintain as there is no duplication of data and consistencyof data is better - reduces the number of anomalies that occur
What is First Normal Form?
1) Remove repeating columns
2) Get rid of any groups of repeating data - for example there must be only one attribute per box
3) Identify the Primary Key
4) Separate data which isn’t atomic into separate values
What is Second Normal Form?
1)Must satisfy first normal form
2)Remove all Partial Key Dependencies - which is when one or more attributes depend on only part of the primary key - this occurs if a composite key is used
3) Must remove any many to many relatonships - so a linked table is made
What is a composite key?
A combination of two or more columns to uniquely identify each row in a database
What is third normal form?
1) Check data is in second normal form
2) Remove any Non Key Dependencies - When all attributes are dependent on the key, the whole key and nothing else but the key
What is a Client Server Database?
A server which provides simultaneous access to a single database for multiple clients
What are the issues with a Client Server Database?
If two people try to access and alter the same record at the same time - concurrent access occurs.
How can you fix concurrent access?
1) Record Locks - When a record is accessed by one user, it is immediately locked until the first user has finished using it - meaning nobody else can access or alter that record
2) Serialisation - Requests from a user to access the field are placed in a queue - once the first person has finished, the next person can use the queue