4.10 SQL Flashcards
What is Normalisation, and how many forms of it are there?
Normalization is the process that is used to come up with the best possible design for a relational database, there are three forms:
1) 1st Normal Form
2) 2nd Normal Form
3) 3rd Normal Form
How should a Normalised Database look like?
1) No Duplicated Information
2) Consistent Data throughout the Data-Base
3) Flexibility so as many items can be added and removed as needed
4) Queries should be able to be processed and an answer returned
How do you know if a table is in First Normal Form
It contains NO repeating attributes or group of attributes
How do you know if a table is in Second Normal Form
1) It must be ALREADY in 1st Normal Form
2) Contain No Partial Dependencies (remove attributes that depend on only part of the primary key by creating additional tables)
How do you know if a table is in Third Normal Form?
1) It must ALREADY be in 1st and 2nd Normal Form
2) All attributes must be dependent on the key the WHOLE KEY and nothing but the key
What is a Foreign Key?
A Foreign Key is an attribute that creates a join between two tables
What types of Relationships between Entities are there?
1) One-to-One
2) One-to-Many
3) Many-to-Many
What are the benefits of having a Normalised database over a Non-Normalised one?
1) Easier to maintain and modify
2) Data Integrity is maintained as there is no duplication of data
3) Customers who aren’t in the database cannot input their data
4) Faster searching and Sorting as the tables are smaller
What is a Primary Key?
An entity identifier, which uniquely identifies every entity in the table
What is an Entity?
An Entity is a category, object, person, event or thing that can be recorded in a Database
E.g Employee, Firm, Actor
What is an Attribute?
An Attribute is a specific detail about an Entity E.g. A Dentist is an Entity but FirstName Surname of the Dentist are Attributes
What is a Relational Database?
A Relational Database is where a separate table is created for each entity identified in the system
What is a Composite Key?
A Composite Key uses more than one Attribute combined together
What is an Entity?
An Entity is information that is stored in Relational Data-Base
What is a Client-Server Database?
A Client-Server Database provides simultaneous access to the database for multiple clients