What is a Database?
A database is an organised, persistent collection of data.
Organised: Data organised into tables, records and fields
Persistent: Non-volatile using secondary storage
Data: Raw info with no context
What does a database consist of?
Files, records and fields
What operations can be performed on databases?
What is an attribute?
An individual fact, detail or characteristic of an entity (aka a field)
What is an entity?
A thing, person, object or relationship about which data can be collected
What is a flat file database?
A database containing a single table
What is a primary key?
A unique piece of information within a table to identify a record
What is a foreign key?
A field in the table which contains the value of a primary key in another table (links to one record)
What is redundancy?
Duplication of data within a database
What is a record?
A collection of fields/attributes about the same thing, person, object or relationship in a table
What is a relational database?
A database with multiple linked tables
What is a conceptual data model
a representation of the data requirements constructed in a way that is independent of any software used to construct the database
Click to view a relationship example
e.g.
Entities:
Student, Teacher, Class, Subject, Classroom…
Attributes:
Student: first name, second name, DOB, student number, year group, form ▪ Teacher: first name, last name, Subject, Teacher ID, DOB
Subject: Subject ID, Requirements, Max Intake
Classroom: Room ID, capacity, room type, facilities
Class: Class ID, Classroom ID, Subject ID, Teacher ID, Period, Time
Relationships:
Teacher teaches Subject
Student attends Class
Entities in a system like this are always singular. The entity describes the characteristics of one instance of the entity, a so-called entity occurrence.
What shape denotes an entity set?
A rectangle
What shape denotes an attribute?
An oval
What shape denotes a relationship?
A diamond
Primary Key Attributes (PK)
uniquely identify each entity occurrence, it is a field that is unique for each record within a table
Foreign Key Attributes (FK)
are found on the ‘many’ (or ‘one’ in a one-to-one) side of a relationship and always take the same values as the primary key attribute in a linked entity. They define the relationship.
Non-Key Attributes
describe characteristics of the entity
Problems with many to many relationships? how to solve them?
Put this list into database notation called Customer with CustomerId as the primary key;
-Customer ID
-Title
-Forename
-AddressLine1
-Town
tblCUSTOMER(CustomerId, Title, Forename, AddressLine1, Town)
—————–
(Underline CustomerId as it is the PK, overline any FK)
This is a simple flat data structure
Problems with flat file data structures
Degree
Number of columns in a table
Attribute/field
1 column in a table