0% found this document useful (0 votes)
2 views

Databases IGCSE

The document provides an overview of databases, including their concepts, structures, and types such as flat file and relational databases. It explains the role of Database Management Systems (DBMS), the importance of normalization, and the use of Structured Query Language (SQL) for database interaction. Additionally, it outlines the advantages and disadvantages of using databases, highlighting aspects like data integrity and complexity.

Uploaded by

gamingzonet094
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Databases IGCSE

The document provides an overview of databases, including their concepts, structures, and types such as flat file and relational databases. It explains the role of Database Management Systems (DBMS), the importance of normalization, and the use of Structured Query Language (SQL) for database interaction. Additionally, it outlines the advantages and disadvantages of using databases, highlighting aspects like data integrity and complexity.

Uploaded by

gamingzonet094
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

6.

Databases
6.1 Database Concepts
A database is an organized collection of data that can be easily accessed,
managed, and updated. Databases are essential for storing large amounts of
data efficiently, ensuring quick retrieval and manipulation.
6.1.1 Database Management System (DBMS)
A Database Management System (DBMS) is software that helps to manage
databases. It provides an interface for interacting with the data stored in a
database. Examples of DBMS include:
 MySQL
 Microsoft Access
 Oracle
 PostgreSQL
6.1.2 Types of Databases
 Flat File Database: A simple database where data is stored in a single
table. It is easy to set up but is not scalable or efficient for complex data.
 Relational Database: Data is organized into tables (also called relations)
with defined relationships between them. The data in tables is structured
using rows and columns, and each table has a primary key to identify
records uniquely.

6.2 Database Structure


Databases are organized in structures that allow data to be stored and retrieved
efficiently.
6.2.1 Tables
 Tables are the fundamental units of data storage in relational databases.
A table is made up of rows and columns.
o Rows (Records): Each row represents a single entry in the table.

o Columns (Fields): Each column represents a specific attribute or


property of the data stored in the row.
 Primary Key: A unique identifier for each row in a table. In the example,
StudentID is the primary key.
6.2.2 Relationships Between Tables
In relational databases, tables can be related to each other through keys.
 One-to-Many Relationship: A record in one table can be related to
multiple records in another table.
o Example: A student can enroll in many courses, but each course can
have many students.
 Many-to-Many Relationship: Each record in one table can be related to
multiple records in another table.
o Example: A student can take multiple courses, and a course can be
taken by many students.
 One-to-One Relationship: Each record in one table corresponds to
exactly one record in another table.
o Example: A student may have one student ID, and each student ID
is associated with one student.

6.3 Database Normalization


Normalization is the process of organizing data in a database to reduce
redundancy and improve efficiency. There are different "normal forms," but the
most common are the 1st Normal Form (1NF), 2nd Normal Form (2NF), and
3rd Normal Form (3NF).
6.3.1 1st Normal Form (1NF)
A table is in 1NF if:
 It contains only atomic values (no multiple values in a single field).
 Each record (row) must be unique.
Example: If you had a table with a column for multiple phone numbers, you
would break it down into separate rows.
6.3.2 2nd Normal Form (2NF)
A table is in 2NF if:
 It is in 1NF.
 All non-key attributes are fully dependent on the primary key.
For example, if a table contains student information and course information but
includes the course instructor (which is dependent on the course, not the
student), the instructor’s information should be stored in a separate table.
6.3.3 3rd Normal Form (3NF)
A table is in 3NF if:
 It is in 2NF.
 No transitive dependencies exist. This means no non-key attribute is
dependent on another non-key attribute.

6.4 Structured Query Language (SQL)


SQL (Structured Query Language) is used to interact with relational
databases. It allows users to retrieve, insert, update, and delete data.
6.4.1 SQL Commands
1. SELECT Command
The SELECT command is used to retrieve data from a table.
Code 1:
SELECT column1, column2 FROM table_name;

Example:
sql
CopyEdit
SELECT Name, Grade FROM Students;
2. WHERE Clause
The WHERE clause is used to filter records.
sql
CopyEdit
SELECT * FROM Students WHERE Grade = 'A';
3. INSERT INTO Command
The INSERT INTO command is used to add new records to a table.
sql
CopyEdit
INSERT INTO Students (StudentID, Name, Age, Grade)
VALUES (4, 'David', 17, 'B');
4. UPDATE Command
The UPDATE command is used to modify existing records.
sql
CopyEdit
UPDATE Students
SET Grade = 'A'
WHERE StudentID = 2;
5. DELETE Command
The DELETE command is used to remove records from a table.
sql
CopyEdit
DELETE FROM Students WHERE StudentID = 3;
6. CREATE TABLE Command
The CREATE TABLE command is used to create a new table.
CopyEdit
CREATE TABLE Students (
StudentID INT PRIMARY KEY,
Name VARCHAR(100),
Age INT,
Grade CHAR(1)
);

6.5 Advantages and Disadvantages of Databases


6.5.1 Advantages
 Data Integrity: Databases enforce rules to ensure that data is accurate
and consistent.
 Data Security: Databases provide tools for managing access to data.
 Redundancy Reduction: Data is organized to minimize duplication.
 Efficient Data Retrieval: Indexed queries allow for faster searching and
retrieval.
 Backup and Recovery: Databases provide mechanisms to back up and
restore data.
6.5.2 Disadvantages
 Complexity: Designing and managing databases can be complex.
 Cost: Database management systems and training can be expensive.
 Performance: In certain cases, large-scale databases may experience
performance issues, especially with complex queries.

You might also like