Theory: Databases Flashcards
Describe the reasons for database normalisation (6)
-efficient without compromising data integrity
-no redundant or repeated data
-faster searching and sorting
-easier to maintain
-duplication of data minimised
-improved data consistency
What is needed to create a data model?
Data requirements
Describe a data model
An abstract model of which entities to record and which attributes of each entity
What does each entity in a table have?
A row/record
Describe the concept of an entity identifier
-sometimes called primary key, or composite key.
-a unique value used to identify a single record
-primary keys are single attributes/fields that use only one field to determine a unique value
-composite keys (or composite primary keys) use multiple attributes/fields to form a unique value for a record.
Describe an entity description:
-eg. Customer(customerID, customeremail)
-describes how information about an entity should be stored in a table.
-the name of the table as well as field names within the brackets
How is the entity identifier/primary key identified in an entity description?
A value can be underlined
Describe the concept of a relational database
-a database containing multiple tables that are linked by common attributes.
What relationship type is not supported by relational databases?
Many to many
Describe the concept of a foreign key
-an attribute/field of a table that is the primary key of another table
Describe first normal form
-no repeating attributes
-data is atomic, all fields contain one value and only one. Two values can not be stored in one field.
Describe second normal form
-partial key dependancies are removed
-For a database with a composite primary key, attributes that don’t depend on all values that make the composite key, are removed to form another table
Describe the concept of third normal form
-no non-key dependancies
-all non key attributes depend on the key, the whole key and nothing but the key.
Properties of SQL
-declarative, readable
List as many SQL commands as you can
-SELECT
-UPDATE
-INSERT INTO…VALUES()
-DELETE
-WHERE
-FROM
-UPDATE
-SET
-ORDER BY
-CREATE (TABLE)
-VARCHAR(size)CHAR(size)
-INT(size)FLOAT(size)