A database should act as a repository/ pool of data separate from the applications within it
Flat-file databases
Verybasic systems that only allow a single table of data. Useful if very simple data is being recorded.
Advantages of relational databases over flat file
-can hold multiple tables
-Normalised without errors associated with flat file databases
Flat-file database
Raw data stored in one table. Used in a simple database with very few pieces of data
Primary key
A field of fields that uniquely identify a record. Sometimes a composite primary key is required
Foreign key
When two tables are related, the primarykey in one table needs to also be used as a field in the other table to form a link between them.
Indexes
If a field is going to be regularly used as part of a search- this can be set to indexed to allow searches to be performed
First normal form
No repeating attributes
Second normal form
Already in first normal form and each field is dependant on the whole primary key (no partial dependencies) (this only applies when there are composite primary keyS)
3rd normal form
Already in second normal form and contain no non-key (transitive) dependencies
How AND OR and IN are used in SQL
Multiple ANDs and ORs can be combined by a list of brackets. IN can be used to specify whether a value is in a specified list
Data independence
A database should act as a repository/ pool of data separate from the applications within it
Flat-file databases
Verybasic systems that only allow a singletable of data. Useful if verysimple data is being recorded.
Advantages of relational databases over flat file
-can hold multiple tables
-Normalised without errors associated with flat file databases
Flat-file database
Raw data stored in one table. Used in a simple database with very few pieces of data
Primary key
A field of fields that uniquely identify a record. Sometimes a composite primary key is required
Foreign key
When two tables are related, the primary key in one table needs to also be used as a field in the other table to form a link between them.
Indexes
If a field is going to be regularly used as part of a search- this can be set to indexed to allow searches to be performed
First normal form
No repeating attributes
Second normal form
Already in first normal form and each field is dependant on the whole primary key (no partial dependencies) (this only applies when there are composite primary keyS)
3rd normal form
Already in second normal form and contain no non-key (transitive) dependencies
How AND OR and IN are used in SQL
Multiple ANDs and ORs can be combined by a list of brackets. IN can be used to specify whether a value is in a specified list