SQL Standard

What Does SQL Stand For? Definition of SQL

Structured Query Language, or SQL for short, is a popular and standard language for interacting and querying information in a relational database.

Databases are everywhere, starting from small handheld devices to massive applications running on the cloud. Although many database systems exist, relational databases are the most popular and influential.

Using the SQL language, you can perform operations, such as adding data, fetching information, searching, updating, performing optimizations, and deleting records.

How Does SQL Work?

As database administrators, we rarely need to understand what goes on under the hood once we run an SQL query. Although this type of abstraction is commonly followed, it can limit those who need to understand the inner workings of a database.

NOTE: There are various variations of the SQL language, and, therefore, challenging to lay out how it works universally.

However, it is evaluated in the following four simple steps once you run an SQL query:

  1. Compilation/Query Parser: The first is a query parser. This step ensures that the SQL query executed follows the defined syntax.
  2. Compilation/Binding: The SQL query is checked for schematics, and a query plan is created for the statement in the binding process. The plan comprises a binary representation of the steps to be followed during the execution of the specified query.
  3. Optimization: Once the query plan has been generated in the binding step, it is taken to the optimization stage. Here, the best algorithm is chosen for the provided query plan.
  4. Execution: The final step is to run the SQL statement by executing the query plan.

The following flow chart illustrates the four steps:

NOTE: Keep in mind that this is a high-level overview of the workings of a SQL Engine. Various database engines may implement these processes differently.

Types of SQL Statements

SQL is a query language that uses a statement-like format. For example, to fetch all the tables in a table, you can use a statement as:

SELECT * FROM TABLE_NAME;

There are various types of queries in SQL. They are organized as follows:

  1. Data Definition Languages – DDL Queries
  2. Data Manipulation Language – DML Queries
  3. Transaction Control Queries
  4. Session Control Queries
  5. System Control Queries
  6. Data Control Language
  7. Data Query Language

Although the previously mentioned queries are common SQL Query types, they may vary depending on the engine implementation. Feel free to reference your database engine documentation to learn more.

Common SQL Terminology

You will hear the following common terminologies when working with SQL and SQL-related databases:

  1. Database – a database refers to a collection of tables, views, indexes, operators, functions, etc.
  2. Query – A query is a command that acts on the SQL data. These types of queries are classified in the types mentioned above.
  3. Client – An SQL Client is any application or connection that interacts with the database in an independent function.
  4. Server – An SQL server is a program that hosts the database and processes all incoming SQL queries from the connected clients.
  5. Transaction – An SQL transaction is a collection of more SQL queries treated and executed as a single unit. In most cases, transactions are atomic. This means that if one of the queries fails, the entire transaction fails. However, this feature may vary depending on the database engine.
  6. Result or Result Set – A result is simply a result of a query to the database.
  7. RDBMS – Relational Database Management System. Refers to a program that offers an SQL Server allowing you to store, manage, query, and fetch data stored in a SQL database. Popular RDBMS include MySQL, SQL Server, PostgreSQL, Oracle, etc.

The terms included in the previous list are the most basic and standard terminologies in the SQL world. However, keep in mind that this is only a minimal list. SQL is extensive and contains a plethora of other terms.

Conclusion

In this article, we introduced you to the theoretical part of SQL Language. Hence, using our SQL tutorials, you will explore how SQL works, various features, and how to use it. We hope you found this article helpful. Check the other Linux Hint articles for more tips and tutorials.

About the author

John Otieno

My name is John and am a fellow geek like you. I am passionate about all things computers from Hardware, Operating systems to Programming. My dream is to share my knowledge with the world and help out fellow geeks. Follow my content by subscribing to LinuxHint mailing list