The Five SQL’s Sub-Languages


Image from: https://powerbidocs.com/2019/12/18/sql-commands/

Standing for Structured Query Language, SQL is a standard programming language to manage and manipulate relational databases. It is used to communicate with databases, reason why, as Tanimura (2021, p.4) underlines, without them and data in tables, “SQL is just a text file. SQL can’t build a website, but it is powerful for working with data in databases”.

To communicate with databases, it has some “key commands”. These commands work like instructions to a table (or tables), used to interact within the database, and they are mainly grouped into five sub-languages (or categories): DQL, DDL, DCL, DML and TCL.

Starting with DQL, which means Data Query Language, SELECT is the most common command, and this sub-language is used to retrieve information from a database. It is the sub-language most people are familiar with.

DDL means Data Definition Language and, having as most common commands CREATE, ALTER (for changing/updating the structure of an object: to add a column to a table, for example) and DROP (for deleting the entire object and structure), this sub-language is used to define or create a database object, such as a table or an index. In analysis, we can use DDL to create temporary tables.

DCL stands for Data Control Language, being a sub-language used to control access to data in a database, which means giving and/or removing permission or privileges. The most common commands are GRANT and REVOKE.

Data Manipulation Language, usually known as DML, is used to act on the data itself in a database: to manipulate or modify it. Just like DDL, three are the most common commands in DML sub-language: INSERT, UPDATE and DELETE. “INSERT adds new records and is essentially the “load” step in extract, transform, load (ETL). UPDATE changes values in a field, and DELETE removes rows” (Tanimura, p. 6).

Finally, TCL means Transaction Control Language and it is a sub-language used to manage transactions or apply permanent changes in a database. COMMIT and ROLLBACK are the “key commands”. 

For more detailed information about the five sub-languages, you can check here: 

  • DQL - https://database.guide/what-is-dql/
  • DDL - https://database.guide/what-is-ddl/
  • DCL - https://database.guide/what-is-dcl/
  • DML - https://database.guide/what-is-dml/
  • TCL - https://database.guide/what-is-tcl/


Comentários