3.10 Fundamentals of Databases Flashcards
entity definition
category of object about which data is to be recorded, Entity1 (Attribute1, Attribute2…)
attribute definition
characteristics about entities
entity identifier
each identity has a unique identifier, an attribute that is unique within that table, underlined
relationships between entities
one-to-one, one-to-many, many-to-many
foreign key
attribute that creates join between two tables, attribute that is common in the tables, called primary key in one and foreign in other
first normal form
contains no repeating attributes or groups of attributes, split repeating attributes so it becomes 1nf
second normal form
database must satisfy first normal form, partial key dependencies are removed
partial key dependency meaning
one or more attributes depends on only part of a primary key
third normal form
conforms to second normal form, database must have no non-key dependencies, all attributes depend on the key, the whole key and nothing but the key
importance of normalisation
easier to maintain and change, no unnecessary duplication of data, faster sorting and searching, saves storage space as data is only held once
normalisation
no data is unnecessarily duplicated, data is consistent throughout database automatically, structure of table is flexible
SQL as declarative language
programmer describes the result that’s required
SELECT command SQL
used for retrieving, SELECT <attribute> FROM <table> WHERE <condition> (ORDER BY <ASC/DESC>)</condition></attribute>
UPDATE command SQL
modifies attributes of already existing entity, UPDATE <table> SET <attribute> = <value> WHERE <attribute> = <value></value></attribute></value></attribute>
DELETE command SQL
removes entities from database, DELETE FROM <table> WHERE <condition></condition>