SQL Commands

nathalia_friederichs

Nathalia Friederichs

Posted on September 9, 2023

SQL Commands

Have you ever heard of SQL? In this article, we will embark on a journey through the realm of data manipulation and definition language, exploring the distinctions between DDL, DML, DTL, DCL, and DQL.

About SQL

Structured Query Language, known by the acronym SQL, is the language used in Database Management Systems (DBMS). It was created by Donald Chamberlin and Raymond Boyce, after Edgar Frank Codd developed the concept of the database while at IBM. Initially, the intention was to name the language SEQUEL, but due to a trademark issue, it was necessary to opt for SQL.

This language plays a crucial role in querying, manipulating, and managing data in relational database systems, widely adopted in the information technology industry.

Although it's a single language, SQL is divided into five categories:

  • DDL (Data Definition Language)
  • DML (Data Manipulation Language)
  • DTL (Data Transaction Language)
  • DCL (Data Control Language)
  • DQL (Data Query Language)

DDL - Data Definition Language

It's used to define and manage the structure and elements that compose a database. In other words, it's responsible for creating, altering, and deleting objects in the database, such as tables, indexes, views, and constraints.

The DDL commands include:

  • CREATE: creates databases, tables, procedures, etc.
  • ALTER: modifies objects created by the CREATE command
  • DROP: deletes what was created by the CREATE command

DML - Data Manipulation Language

It's used to perform operations involving the insertion, updating, and deletion of data in a database.

It's essential for the active manipulation of data, allowing the execution of dynamic tasks and maintenance of updated and relevant information according to the system and user needs.

The DML commands include:

  • INSERT: inserts data into a table
  • UPDATE: modifies an existing record in a table
  • DELETE: removes a record from the table

DCL - Data Control Language

These commands are used to define which users or roles have permissions to access, modify, or perform specific operations on database objects, such as tables, views, and stored procedures.

It plays a fundamental role in data protection and access control within the database environment.

Examples of DCL commands:

  • GRANT: grants database access to a user
  • REVOKE: revokes database access from a user

DTL - Data Transaction Language

These are the commands that focus on managing transactions in a database. Transactions refer to sequences of database operations executed as a single logical unit.

Examples of DTL commands:

  • BEGIN TRANSACTION: initiates a transaction
  • ROLLBACK: undoes a transaction
  • COMMIT: confirms a transaction

DQL - Data Query Language

It plays a crucial role in enabling data analysis, report generation, and obtaining useful information from large datasets. By using DQL, users can efficiently and systematically explore and examine data stored in the database, enabling informed decision-making based on the retrieved information.

The SELECT command with all its clauses, JOIN, WHERE, AND, OR, GROUP BY, ORDER BY, HAVING, LIKE, is an example of DQL.

In the upcoming articles, we will discuss the syntax of DDL, DML and DQL.

💖 💪 🙅 🚩
nathalia_friederichs
Nathalia Friederichs

Posted on September 9, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related