SQL Statements

nishanthan-k
2 min readJun 4, 2023

--

SQL (Structured Query Language) is a programming language used to manage and manipulate relational databases. It is the foundation for most popular database systems such as MySQL, Oracle, and SQL Server. SQL statements are used to interact with these databases to perform operations like data insertion, deletion, and modification queries.

SQL statements follow a fixed syntax structure consisting of keywords, functions, clauses, and operators. These statements can be divided into five different categories, each serving different purposes.

1. Data Definition Language (DDL):

DDL statements are used to define and modify database schema objects such as tables, constraints, indexes, and views. Here are some essential DDL statements:

CREATE — creates a new table, view, trigger, or other database objects.

ALTER — alters the structure of the existing database objects.

DROP — removes an existing object from the schema.

2. Data Manipulation Language (DML):

DML statements are used to add, modify, and delete database records. Here are some commonly used DML statements:

SELECT — retrieves data from one or more tables in the database.

INSERT — puts one or more rows into the specified table.

UPDATE — modifies existing rows in the table.

DELETE — removes one or more rows from a table.

3. Data Query Language (DQL):

DQL statements are used to query database records without modifying them. The SELECT statement is the primary DQL statement.

4. Data Control Language (DCL):

DCL statements are used to grant and revoke access privileges to database users. Here are some DCL statements:

GRANT — permit a user to perform specific operations.

REVOKE — removes a specific privilege or all privileges from a user.

5. Transaction Control Language (TCL):

TCL statements are used to manage database transactions. Here are some essential TCL statements:

COMMIT — makes changes in the transaction permanent.

ROLLBACK — reverses or undoes the changes made in the transaction.

SAVEPOINT — creates a specific point within a transaction to which one can roll back.

In conclusion, SQL is a powerful language that assists in database management by offering various query commands through its statements. Each statement serves a different purpose and requires a certain level of understanding to operate frequently. SQL statements can be combined to build complex queries for application-specific operations. Thus, every developer or database administrator must have good knowledge of SQL statements to manage any database easily.

--

--

nishanthan-k
nishanthan-k

Written by nishanthan-k

Data-driven professional with a passion for transforming complex information into insights. Expert in data analysis, visualization, and storytelling.

No responses yet