Topic 10 - Fundamentals of Databases Flashcards
What is a primary key?
What is a foreign key?
A primary key is an attribute that provides an unique identifier for every entity in a database table.
A foreign key is an attribute in a table which is the primary key in another, related, table.
How are tables with many-to-many relationships linked together?
A new ‘link table’ is created
What defines the First Normal Form of database normalisation?
A database contains no repeating attributes
What is database normalisation and why are databases normalised?
Ensuring that entities contain no redundant or repeated data.
So they can be more efficient without compromise to the integrity of their data. They are easier to maintain reducing update, insertion and delete anomalies
What defines the Second Normal Form of database normalisation?
It qualifies for First Normal Form.
Partial key dependencies are removed, attributes that only rely on certain other attributes.
What defines the Third Normal Form of database normalisation?
It qualifies for First and Second Normal Form.
It has no non-key dependencies
What is the structure for a SELECT command?
SELECT <attribute> FROM <table> WHERE <conditions> (ORDER BY ASC/DESC optional)</conditions></attribute>
What is the structure for a UPDATE command?
UPDATE <table> SET <attribute> = <value> WHERE <attribute> = <value></value></attribute></value></attribute>
What’s the structure for a DELETE command?
DELETE FROM <table> WHERE <condition></condition>
What’s the structure for an INSERT command?
INSERT INTO <table> VALUES (<value1>, <value2>, …)</value2></value1>