How SQL Works Internally?
Do you know How Actually #SQL Enginee Works internally or behind the Scenes?
.
By Karthik Kondpak
.
.
.
.
.
.
.
.
.
Let's understand the Concept in depth :-
===============================
✍️Let's consider a Student table and understand :-
I'd. name. age
----- ----------. ----------
1. A. 20
2. B. 30
3. C. 40
✍️Lets consider a query
SELECT I'd, name , age from STUDENT
Where age=30;
✍️Lets understand Step by step how actually SQL enginee Works:-
============================
1) Firstly It executes the. " from STUDENT" , which means it looks for the #Student Table in the Database whether it is present or not .
✏️If it is present it moves further if not it throws a error saying no such #TABLE" or "#TABLE" not found.
2) If #Table is Present then it it first creates the #dummy table selecting all the fields in the #ram along with Data.
I'd. name. age
-----. -----------. ---------
1. A. 20
2. B. 30
3. C. 40
✏️After Creating dummy table now it will check if any matching conditions or any #filtering criteria is there in #Where clause in a table.
3) If any Filtering of data.
✏️Again a #dummy table is created on #Top of the dummy table( which is already present) and here the filtering and matching conditions are checked.
I'd. name. age
1. A. 20
2. B. 30
3. C. 40
✏️Here SQL enginee checks the filtering Criteria in #Where Clause
✏️SQL enginee goes to Age column(as it is mentioned in #Where Clause) and checks #one by one record and it finds age =30 is present or not.
✏️If Filtering criteria is met or not it will move further
4) Now SQL enginee goes to the #SELECT statement and checks what to be displayed what to be projected.
✏️ If Filtering Criteria has met we will get data or we will get empty dataset.
✏️Now it will display the the columns and as well as data from #1St dummy table.
4 Steps:-
========
1) Checks for the table in Database
2) If present #create a dummy table in #ram and checks if any filtering criteria are ther in #where clause
3) If any filtering criteria is there then it #create a #dummy table on #top of the #dummy table already present and it will perform filtering criteria and checks whether the mentioned criteria met or not
4) Finally Select statment all the files which met Filtering criteria and Projects them in tabular form.
Conclusion :-
==========
1) We never #perform any operations or #filtering criteria on #original table
2) Dummy tables are flushed off from the ram once Query is executed.
Comments
Post a Comment