10. Fundamentals Of Databases Flashcards
(35 cards)
What is an entity ?
A thing about which data is to be stored eg. customer
What are attributes ?
Characteristics of entities
What are databases formed from ?
Tables
What do tables store ?
Entities
What must each entity have ?
A unique Identifier
What are the three types of relationships between tables in a database ?
- One to One
- Many to Many
- One to Many
What is a primary key ?
An attribute that provides an unique identifier for every entity in a database table .
What condition must be met when tables are linked by shared attribute ?
The attribute must be a primary key in one table and be be called a Foreign Key in the other.
What is a foreign key ?
An attribute which is a primary key in another related table
What is a composite primary key ?
Combination of attributes to form a key where it’s not possible to form a primary key from one attribute
What must be created when linking many to many relationships ?
A new table - Link table
What is Normalisation ?
Ensuring databases contain no redundant or repeated data
Why are databases normalised ?
Increase efficiency without any compromise to the integrity of their data
What are the pros of normalisation ?
- Reduces the number of updates, insertion and deletion anomalies that occur
- Easier to maintain
- Faster searching and sorting
What happens when a database conforms to the first normal form ?
There are no repeating attributes and is atomic (no single column contains more then one value )
What happens when a database conforms to the second normal form ?
Must satisfy first normal form and partial key dependencies are removed
What is a partial key dependency ?
Occurs in composite primary keys when a non-key attribute doesn’t depend on the whole composite key
What happens when a database conforms to the third normal form ?
No non-key dependencies
How is a database that meets the third normal form described ?
All non-key attributes depend on the key , the whole key and nothing but the key
What are the four main SQL commands ?
SELECT, UPDATE , INSERT , DELETE
What is the fixed length string data type in SQL ?
CHAR(Size)
What is the variable length string data type in SQL ?
VARCHAR(Size)
What is the integer data type in SQL ?
INT(Size)
What is the Number with fractional part data type in SQL ?
FLOAT (Size, Precision )