1.3.2 Databases Flashcards
How to achieve first normal form
Data should be Atomic – i.e. cannot be broken down further. Therefore there must be:
There are no columns with repeated or similar data
Each row is unique i.e. it has a primary key
Each field has an unique name
atomic does not mean ‘single word’. It simply means that it would make no sense to reduce the data item any further as it would lose its meaning.
i.e. Chipping Campden School is a valid, atomic school name even though it contains three words
How to achieve second normal form
Only applies to tables with a COMPOUND KEY
If there is a single primary key that table is already in 2NF
For tables with a COMPOUND KEY, every non key attribute must depend on the WHOLE KEY.
How to achieve third normal form
Attributes must already be in 2NF. There are no non-key attributes that depend on other non key attributes
What this is trying to do is to spot yet another source of redundant data. If the value of an attribute can be obtained by simply making use of another attribute in the table, then it does not need to be there. Loading that attribute into another table and linking to it will make the database smaller.
Why is data normalised
The database does not have redundant data, it is smaller in size so less money needs to be spent on storage
Because there is less data to search through, it is much faster to run a query on the data
Because there is no data duplication there is better data integrity and less risk of mistakes.
Because there is no data duplication there is less chance of storing two or more different copies of the data
One change can be made which can instantly be cascaded across any related records.
Name the problems with normalisation
You need to be careful with trying to make data atomic. Just because you can split some types of data further, it isn’t always necessarily the correct thing to do. For example, telephone number might contain the code followed by the number 01234 567890. It wouldn’t be sensible to separate out these two items.
You can end up with more tables than an unnormalised database
The more tables and the more complex the database, the slower queries can be to run
It is necessary to assign more relationships to interact with larger numbers of tables
With more tables, setting up queries can become more complex
Name the types of keys used in data bases.
The Primary key which is a unique identifier
A foreign key forms a link between entities
A compound key can be formed from two or more entities to make a unique record
What does DBMS
Data base management system
What is DBMS used for
This is a tool to manage a database
What are some of the key features DBMS
A command language that allows you to create, delete and alter the database (data description language or DDL)
A way of documenting all the internal structures that make up the database (data dictionary)
A language to support the manipulation and processing of the data (data manipulation language or DML)
Support the ability to view the database from different viewpoints according to the requirements of the user
Provide some level of security and access control to the data
Define Data dictionaries
A ‘data dictionary’ describes the structure and attributes of data ‘items’ to be used within a software application (usually a database).
Name the main features of a Data dictionaries
A data dictionary includes the names and descriptions of the entites (tables) and the attributes (fields) contained in each table. It also documents information about the data type, field length and other things such as validation.
The main purpose of the data dictionary is to provide metadata, or information about data. Technically, it is a database about a database.
There is no one set standard in terms of layout or the level of detail to which a data dictionary should be written.
Software development teams need a comprehensive data dictionary to refer to during the development and maintenance of a new database. This is so that they are all working using the same data formats when reading or writing data.
Define DML
Data manipulation language
What is the use of DML
The language is used in the manipulation of the data such as inserting deleting
Name some of the key functions of DML
Insert
Delete
Update
Process data
Define DDL
Data description language