← IB Computer Science

SQL, queries and transactions

SQL (structured query language) is used to build a database and to work with the data inside it. This unit covers the four SQL language families, how to query and join tables, and how databases stay reliable for many users at once using views and ACID transactions. Aggregate functions, views and transactions are Higher Level topics.

Slide 1 / 4

The SQL language families

The DBMS uses four SQL language familiesDDLData Definitionbuilds structureCREATEALTERDROPDMLData Manipulationworks with dataSELECTINSERTUPDATEDELETEDCLData ControlsecurityGRANTREVOKETCLTransaction Controlcommit / undoCOMMITROLLBACKDDL defines · DML manipulates · DCL secures · TCL controls transactions
  • A database management system (DBMS) uses four types of SQL language.
  • Data definition language (DDL) uses CREATE, ALTER and DROP to build the database structure.
  • Data manipulation language (DML) uses SELECT, INSERT, UPDATE and DELETE to work with the data.
  • Data control language (DCL) uses GRANT and REVOKE for security; transaction control language (TCL) uses COMMIT and ROLLBACK.

Check you've got it

0/4

1. In SQL, which family of commands includes CREATE, ALTER and DROP, used to define the structure of the database?

2. Which SQL operation combines rows from two tables using a common attribute (the foreign key) and returns only the rows that have a match in both tables?

3. You want to display only the countries that have more than two customers, using COUNT. Which clause must you use for this condition, since WHERE cannot be used with aggregate functions?

4. Two users try to edit the same record at the same time. Which ACID property keeps transactions independent so that one cannot interfere with another until it is committed?

Free revision content. Multiple-choice answers are marked instantly. Written answers are marked by AI on /free-mark.