SQL

  • SQL stands for Structured Query Language. It is used for storing and managing data in relational database management system (RDMS). In RDBMS data stored in the form of the tables.
  • It is a standard language for Relational Database System. It enables a user to create, read, update and delete relational databases and tables.
  • All the RDBMS like MySQL, Informix, Oracle, MS Access and SQL Server use SQL as their standard database language.
  • SQL allows users to query the database in a number of ways, using English-like statements.
  • SQL is mostly used by engineers in software development for data storage. Nowadays, it is also used by data analyst for following reason:

SQL Statement Rules:

SQL follows the following rules:

  • Structure query language is not case sensitive. Generally, keywords of SQL are written in uppercase.
  • Every SQL statements should ends with a semicolon.
  • Statements of SQL are dependent on text lines. We can use a single SQL statement on one or multiple text line.
  • Using the SQL statements, you can perform most of the actions in a database.
  • SQL depends on tuple relational calculus and relational algebra.

How does SQL process works:

  • When an SQL command is executing for any RDBMS, then the system figure out the best way to carry out the request and the SQL engine determines that how to interpret the task.
  • In the process, various components are included. These components can be optimization Engine, Query engine, Query dispatcher, classic, etc.
  • All the non-SQL queries are handled by the classic query engine, but SQL query engine won't handle logical files.
DBMS SQL

SQL Query Execution Order

DBMS SQL

In the above diagrammatic representation following steps are performed:

  • Parsing: In this process, Query statement is tokenized.
  • Optimizing: In this process, SQL statement optimizes the best algorithm for byte code.
  • From: In SQL statement, from keyword is used to specify the tables from which data fetched.
  • Where: Where keyword works like conditional statement in SQL.
  • Join: A Join statement is used to combine data from more than one tables based on a common field among them.
  • Group by: It is used to group the fields by different records from table(s).
  • Having: Having clause is also works like conditional statement in SQL. It is mostly used with group by clause to filter the records.
  • Order by: This clause is used to sort the data in particular order by using "ASC" for ascending and "DESC" for descending order.
  • Select: This "Data Manipulation Language" statement is used to get the data from the database.
  • Limit: It is used to specify the how many rows returned by the SQL select statement.