Databases
What is a database?
- An organised collection of data stored and accessed electronically.
- Example: A customer database stores information like names, addresses and purchase history for a business.
Components:
SQL (Structured Query Language)
-
Definition: SQL is a standardised language used to manage and manipulate relational databases.
-
Common Commands:
-
SELECT: Retrieves data from a database.
-
INSERT: Adds new data to a table.
-
UPDATE: Modifies existing data.
-
DELETE: Removes data from a table.
-
CREATE: Defines a new table or database.
-
ALTER: Modifies an existing table structure.
-
DROP: Deletes a table or database.
Example:
-
SELECT Statement:
SELECT * FROM Students WHERE Grade = 'A'; retrieves all students with an 'A' grade.
|
Relational Databases
-
Definition: Relational databases organise data into tables (rows and columns) and use relationships to link related data.
-
Key Concepts:
-
Tables: Structures that store data in rows and columns.
-
Primary Key: A unique identifier for each record in a table.
-
Foreign Key: A field that creates a relationship between two tables.
-
Indexes: Structures that improve the speed of data retrieval.
Example:
-
Table Structure:
-
Students Table: Contains columns like StudentID, Name, Grade.
-
Courses Table: Contains columns like CourseID, CourseName.
- Relationship:
StudentID in Courses table can reference StudentID in Students table.
|
Data Management
-
Definition: Data management involves the practices, processes and tools used to manage and protect data throughout its lifecycle.
-
Key Activities:
-
Data Storage: Efficiently storing data in databases.
-
Data Retrieval: Extracting relevant data using queries.
-
Data Security: Protecting data from unauthorised access and breaches.
-
Data Backup: Creating copies of data to prevent loss.
-
Data Integrity: Ensuring accuracy and consistency of data.
Example:
-
Data Backup: Regularly creating copies of the database to protect against data loss.
|
Understanding SQL and relational databases is key to efficient, secure data management.