Computer Science · Theme A: Concepts of computer science
A3.3 — Database programming
Computer Science · SL / HL · syllabus-mapped notes
CS_A3.3.1
SQL data language types (DDL and DML)
How DDL defines structures and DML manipulates data.
Full note — freeSQL (Structured Query Language) is split into sub-languages. You must be able to outline the difference between the two data language types that must be covered. Data definition language (DDL) : statements that define or change the structure of the database. Commands such as CREATE, ALTER and DROP build or modify tables and other objects. Data manipulation language (DML) : statements that work with the data held inside those structures. Commands such as SELECT, INSERT, UPDATE and DELETE retrieve and change the rows of data. Note: SQL syntax may vary between different database systems, but the DDL versus DML distinction holds.
CS_A3.3.2
Queries across two tables
Joins, filtering, pattern matching and ordering with named SQL commands.
You must be able to construct queries between two tables using joins, relational operators, filtering, pattern matching and ordering. SELECT ... FROM ... JOIN : choose columns and combine two related tables on a matching key. SELECT Student.name, Course.title FROM Student JOIN Course ON Student.courseID …
CS_A3.3.3
Updating data with SQL
INSERT, UPDATE, DELETE and the cost of updating indexed columns.
You must be able to explain how SQL updates data in a database using three DML statements. INSERT INTO : add new records to a table. INSERT INTO Student (name, grade) VALUES ('Mia', 7); UPDATE ... SET : modify existing data, filtered by WHERE. UPDATE …
CS_A3.3.4
Aggregate calculations
AVERAGE, COUNT, MAX, MIN, SUM on grouped data.
This card is HL only. You must be able to construct calculations using SQL's aggregate functions on grouped data to aid reporting and decision-making. COUNT , SUM , AVERAGE , MAX , MIN : summarise many rows into a single value, usually per group. SELECT …
CS_A3.3.5
Database views
Virtual and materialized views and what they are used for.
This card is HL only. A view is a stored query presented as a virtual table. You must be able to describe the two kinds. Virtual view : stores only the query definition and is computed fresh each time it is used, so it always …
CS_A3.3.6
Transactions and data integrity
ACID properties and TCL commands.
This card is HL only. A transaction is a group of operations treated as one unit. You must be able to describe how transactions maintain data integrity through the ACID properties. Atomicity : the whole transaction succeeds or none of it does; partial changes are …
