0% found this document useful (0 votes)
19 views26 pages

AS8.2 - Database Management Systems

The document outlines the curriculum for the International A Level Computer Science course, focusing on Database Management Systems (DBMS). It covers key concepts such as the features of a DBMS, its conceptual architecture, SQL functionalities, and practical SQL query examples. Additionally, it includes references to resources for further SQL exercises and solutions.

Uploaded by

schoolfinish2026
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views26 pages

AS8.2 - Database Management Systems

The document outlines the curriculum for the International A Level Computer Science course, focusing on Database Management Systems (DBMS). It covers key concepts such as the features of a DBMS, its conceptual architecture, SQL functionalities, and practical SQL query examples. Additionally, it includes references to resources for further SQL exercises and solutions.

Uploaded by

schoolfinish2026
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 26

International A Level

Computer Science
Databases
AS 8.2 Database Management Systems
International A Level

Overview
• AS 8.1: Data Storage and Retrieval
• AS 8.1: File-based Approach
• AS 8.1: Relational Database Approach
• AS 8.1: Entity-relationship Diagrams
• AS 8.1: Normalisation
• Database Management Systems
• AS 8.3: DBMS Languages (DDL, DML, DCL, TCL)
• AS 8.3: Structured Query Language (SQL)
Features of a DBMS
• Query Processor
• Creation and execution of SQL queries
• Developer Interface
• Direct access to create and modify database tables, indexes, etc
• Data Dictionary
• Store of metadata; definitions of tables, attributes, and details of physical storage
• Indexes
• Internal tables to improve query performance
• Maintenance Tools
• Integrity checking
• Backup and Restore
Conceptual Architecture of a DBMS
Each Database Management System has its
External Level own internal architecture – for large
commercial DBMS such those produced by
Oracle, IBM, and Microsoft, this architecture is
proprietary.

Conceptual Level However, all DBMS, in common with most


complex software systems, adopt a 'layered'
model.

The American National Standards Institute


Internal Level proposed a three-level architecture for DBMS
which is useful in discussing the main levels or
layers of a DBMS.

Physical Storage
Conceptual Architecture of a DBMS
There are multiple user views of data
External Level Each user view has a particular purpose, and
excludes data which are irrelevant to a
particular type of user (or which should not be
accessed by a particular type of user)

Conceptual Level One view may be used by several different


types of user

Most programs access the database through


an external view
Internal Level
Each external view is described by an external
schema

Physical Storage
Conceptual Architecture of a DBMS

External Level

The Conceptual Level contains the single


logical schema for the whole database – the
Conceptual Level model of relations and relationships. The data
dictionary, and indexes are also held in this
level, maintained by the Database
Administrators (DBAs)
Internal Level
The Conceptual Level is directly accessed by
DBAs and by DBMS tools such as the query
processor.

Physical Storage The Conceptual Level should be independent


of the computer hardware, and supporting
software (such as the OS).
Conceptual Architecture of a DBMS

External Level

Conceptual Level

The Internal Level contains the single internal


Internal Level schema which defines the stored records, data
fields, indexes, etc.

The Internal Level is closely tied to the


computer hardware and software
Physical Storage
Conceptual Architecture of a DBMS

External Level The Database concept separates users and


user programs …

… from the physical representation and storage


Conceptual Level of data, meaning that we can change these
details independently

Internal Level

Physical Storage
High-level Structure of a DBMS
Users Applications

Interface Interface

Monitoring &
Query Processor Access Controls
Reporting
Interface

Other DBMS

Storage Engine

Database Management System


SQL Additional Features
• SUM(), COUNT(), AVG(), MAX(), MIN()
• AS
• ORDER BY
• GROUP BY
• JOIN
Arithmetical Operators – SUM()
SELECT SUM(ProductAmount) FROM OrderLine WHERE Orderline.OID = 101

Gives us the total number of items ordered on a specific Order ID (101)


Make sure that you pick an Order ID that exists in your database…
Arithmetical Operators – COUNT()
SELECT COUNT(*) FROM Product

Tells us how many product types we sell


Arithmetical Operators – AVG()
SELECT AVG(UnitPrice) FROM Product

Gives us the average UnitPrice from the Product Table


Arithmetical Operators – MAX()
SELECT MAX(UnitPrice) FROM Product

Tells us the highest-priced item we sell


Arithmetical Operators – MIN()
SELECT MIN(UnitPrice) FROM Product

Tells us the lowest-priced item we sell


Alias – AS
SELECT Name AS "Product Name", MIN(UnitPrice) AS "Price" FROM Product

Tells us the lowest-priced item we sell, using the column names "Product
Name" and "Price" instead of the database attribute names
Sorting Rows – ORDER BY
[ASC/DESC]
SELECT * FROM Product ORDER BY UnitPrice DESC

Lists all of the products, ordered from most to least expensive


Grouping Rows – GROUP BY
SELECT SUM(ProductAmount) AS "Product Count", OID AS "ORDER ID"
FROM OrderLine GROUP BY OID;

Gives the total number of items ordered on each Order ID, grouped by Order ID
Joins Practical 1 – List of Orders
• Display a list of orders, showing:
• OrderID (from the CustomerOrder Table)
• FirstName (from the Customer Table)
• OrderDate (from the CustomerOrder Table)
Joins Practical 1 – List of Orders
SELECT CustomerOrder.OrderID, Customer.FirstName, CustomerOrder.OrderDate
FROM CustomerOrder
JOIN Customer ON CustomerOrder.CID = Customer.CustomerID
Joins Practical 1 – List of Orders
(Alternative)
SELECT CustomerOrder.OrderID, Customer.FirstName, CustomerOrder.OrderDate
FROM Customer, CustomerOrder
WHERE CustomerOrder.CID = Customer.CustomerID
Joins Practical 2 – List of Products on
Order X
• Display a list of products on customer order number 101 showing:
• Name (from the Product Table)
• Unit Price (from the Product Table)
• Amount on Order X (from OrderLine Table)
• "Order Number" for Order X (from OrderLine Table)
Joins Practical 2 – List of Products on
Order X
SELECT Product.Name, Product.UnitPrice, OrderLine.ProductAmount,
Orderline.OID AS "Order Number"
FROM Product
JOIN OrderLine ON Product.ProductID = OrderLine.PID
WHERE OrderLine.OID = 101
Joins Practical 3 – List of Products by
Total Ordered
• Display a list of products, their prices, and the total number of each
ordered, sorted from the most-ordered to the least-ordered product,
showing:
• Name (from the Product Table)
• Unit Price (from the Product Table)
• Total ordered
Joins Practical
SELECT Product.Name, Product.UnitPrice, SUM(OrderLine.ProductAmount)
AS "Total Ordered"
FROM Product JOIN OrderLine ON Product.ProductID = OrderLine.PID
GROUP BY Product.Name
ORDER BY "Total Ordered" DESC
One Note
• I have placed a skeleton Python solution for the shop database on
OneNote in the SQL Exercises Section
• You will also find all of the Additional SQL Features in the same
Section

You might also like