Execution flow of SQL queries

Execution flow of SQL queries

Here, I'm going to talk about the different SQL Statements which are DDL, DML, and DCL. Every SQL statement has its own format and the parser will execute every SQL statement in a specific order. There are specific steps for SQL Query execution steps using which one can check the order of execution of the statement to apply the logic as per the requirements.

1. DDL – Data Definition Language: image.png

2. DML – Data Manipulation Language: image.png

3. DCL – Data Control Language: image.png

4. DQL – Data Query Language:

SELECT: Retrieves certain records from one or more tables.

Select statement in SQL is used to fetch the records from the table. Here the main point is how that SQL Statement Execution order is done. To select the data from the database table SQL select statements are used. The actual result is stored in the Result table which is called a result set and it is stored in the cache, not in the main memory.

Select Syntax by using ‘ * ’

Select * from Table_name;

Select Syntax by using column names

Select column_name1,column_name2 from table_name;

SQL Query Execution Order

image.png