Learn SQL #1: What is SQL?

What is SQLWhat would a database be if you couldn’t read the information stored in it? One of the main pillars of any database system is the programming language that you use to extract data from the database. This is where SQL comes along. But, what is SQL?
Well, SQL stands for …

What is SQL?

SQL stands for Structured Query Language and is the tool that you can use to extract information from your database and display it in a customized way.

Just from the name of this programming language, we can learn a few things about what is SQL. The fact that the programming language is

  • STRUCTURED: data that is stored in the databases is structured in an organized table that can be interconnected.
  • QUERY: this programming language is used to “ask” the database to return some data which it has stored.

Why would you use SQL?

SQL is specifically designed and is a standard language that works with Relational Databases.

What are relational databases?

A Relational Database is a collection of information stored into structures called tables and all is organized according to a relational model. Basically, relational means that information is logically connected to other pieces of information.

A person has to have a name, a phone has to have a phone number, a car has to have a color. All of these details, which belong to different real-life objects can be stored in a relational database as linked information.

The most common Relational Database Management Systems (RDBMS) are:

  • Oracle
  • SQL Server (Microsoft SQL)
  • MySQL
  • PostgreSQL
  • IBM DB2
  • SAP Sybase

Although, even if all of these database systems use SQL, each of them uses a slightly different version (dialect) of SQL.

Oracle database systems use PL/SQL (Procedural Language/Structured Query Language),  SQL Server uses T-SQL also known as Transact-SQL.

The advantages of using SQL directly:

  • It allows users to access their data from their databases and to describe their data
  • Allows users to define or modify the data in their databases systems
  • It offers direct access to manipulating the databases and/or the tables stored in the databases
  • Allows users to directly create programmatic functions which can run directly on the database, without the need of an external application

To conclude, if you know SQL then YOU are in control of your data, YOU can directly manipulate it and alter it. With SQL you have the option of creating a logic that would extract valuable INFORMATION from the stored data.

To get even a more complete overview of what is SQL it would be useful to know how it works. Every time you send a command (in technical language this is called a query) to the database, for most of the database systems there is a process that happens:

  1. The SQL Query which you send to the database to extract information is first handled (read) by the Query Language Processor. This component decides if the query you wrote is syntactically correct (all of the commands are in the correct order and follow the STRUCTURE defined by that particular dialect of SQL).
    • The job of the Query Language Processor is done in part by the Parser, which takes care of the syntax of the query
    • If the syntax is correct, the Optimizer comes into action and determines the best way of executing the query based on the current state of the database system
  2. The next step calls onto the DBMS Engine where all the actions of creating, reading, updating, or deleting data from a database happen.
    • This job is also made partly by the File Manager, which takes care of looking up and reading or altering data on the database’s physical disks.
    • The Transaction Manager’s role is to make sure that all queries that execute on the database will follow the rules specified by ACID

1 thought on “Learn SQL #1: What is SQL?”

Leave a Comment