Advertising

What is SQL? How SQL Works?

What is SQL? How SQL Works?
SQL programming language (?) was developed by Donald D. Chamberlin ve Raymond F. Boyce in IBM after the concept of a relational database was introduced by Edgar F. Codd in the 1970’s years. Today, I will talk about the history of SQL, and the concepts of SQL Server and MySQL, while talking about what SQL, which stands for Structured Query Language, is, what it does, and what kind of syntax it has.

What is SQL (Structured Query Language)?

SQL (Structured Query Language) is a DSL computer language that uses the relational data model to store, query, and process information in the computer environment in tables. SQL, which stands for Structured Query Language, was developed at IBM after the introduction of the relational database model in the 1970s.

SQL is designed for the purpose of calling stored data and performing operations on the data.

Is SQL a Programming Language?

As a result of my research, I saw that some sources claim that SQL is a programming language, but several sources claim the opposite and emphasize that SQL is not a programming language contrary to what is known. In a discussion on the subject opened on Reddit, "SQL is a programming language." opinion prevailed. The views shared in the forum showed that SQL is actually a programming language, but it is not seen as a programming language because it is used only for query purposes by many programmers. [one]

Another source says that SQL is not a General Purpose Language (GPL) language, as it cannot be used alone for designing applications, unlike languages such as Python, C++, and JavaScript. [2]

In summary, SQL is a computer language classified as Domain-Specific Language (DSL), not a General Purpose Language (GPL) languages like C, Java, and Python. [3] To say that SQL is a programming language would mean accepting that other DSL languages such as HTML are also programming languages, so it would not be an accurate definition to call SQL a programming language.

History of SQL

Before the emergence of SQL, the relational database model was invented by Edgar F. Codd at IBM in the early 1970s. [4] After this development, Donald D. Chamberlin and Raymond F. Boyce at IBM learned the relational database model from Codd. The first attempt of these two computer scientists was a language called SQUARE (Specifying Queries in A Relational Environment). The SQUARE language needed to be revised as it needed the use of subscripts and superscripts. In 1973, they continued their work at the San Jose Research Laboratory and provided the preparation of a new language they named SEQUEL.

Since SEQUEL also bore the name of a trademark at that time, a name change was needed. Thus, SEQUEL was changed to its current name, SQL (Structured Query Language), by removing the vowels.

After the test stages, it was understood that SQL was useful and practical. Over time, it began to be used for various services and products. In addition, SQL was standardized by ANSI (American National Standards Institute) in 1986 and ISO (International Organization for Standardization) in 1987.

What Does SQL Do?

SQL enables data to be manipulated, stored, and accessed when queried. In short, SQL enables communication with the database. With SQL you can basically do the following:

  1. Creating, and deleting databases. (CREATE, DROP)
  2. Interfering with data in the database. (INSERT, DELETE, UPDATE)
  3. Querying data, and accessing data with desired properties. (SELECT)
  4. Enabling repeated use of SQL codes by creating stored procedures. (CREATE PROCEDURE)
  5. Keeping historical records. (Logs)
  6. Establishing relationships between data. (Relational Database)
  7. Making authorization.
  8. Linking relational tables together. (JOIN)
  9. Creating data viewers based on filters and sorts. (VIEW)

By 2023, what SQL can do is certainly more than these items. However, I think it will be enough to mention this much in order not to expand the subject.

How SQL Works?

SQL (Structured Query Language) performs various operations to query or manipulate data. By checking the syntax of the codes to be applied, it understands what the action is, controls the authorization of the user, and creates a plan for the data to be accessed or edited from the database. Returns a result after completing its operations. This result can be a positive or negative return on the transaction or a table showing the data.

The above SQL operations are completed with the help of some components:

  1. Parser

    SQL parser is used to check the correctness of the spelling and whether the user is authorized by parsing the query commands. Whether the SQL statements are written in accordance with the grammatical rules and the authority of the user performing the operation is checked here.

  2. Relational engine

    A relational Engine, also known as Query Processor, provides processing of user-submitted queries. It creates a plan according to the query status and puts it into practice, so that the data stored from the Storage Engine is retrieved and processed to return a result.

  3. Storage Engine

    It enables the data to be stored and transmitted when requested. Storage Engine consists of several components: [5]

    1. File Types: There are 3 types of files: primary, secondary, and log.
    2. Access Method: It creates an interface between transaction logs, query executor, and buffer manager. [5]
    3. Buffer Manager: Performs Plan Cache, Data Parsing, and Dirty Pages operations.
    4. Transaction Manager: Provides the management of transactions.

SQL Spelling & Syntax Structure

SQL (Structured Query Language) has certain grammatical rules like any other language.

  1. Clause: In SQL, such as can, may, if, whether, SELECT, UPDATE, DELETE, CREATE are the basic elements of the sentence to be written for the query.
  2. Expressions: Scalar quantities are various expressions that can be made up of tables.
  3. Predicates: Conditions that work according to bool truth tables. If 1 + 1 = not 2, then in a predicate the result returns 0 according to the Bool truth table. Filtering with such a condition will not yield any results. Conditional statements like this are called predicates.
  4. Queries: Clause, expression, predicate, etc. that enable queries in SQL. Structures formed by the combination of components are called queries.
  5. Statements: Statements used with Clauses in SQL are called. WHERE username = 'ofcskn;' is a Statement. SELECT * FROM WHERE username = 'ofcskn' is a Query with two statements.

What are Basic SQL Statements?

  1. SELECT, SELECT DISTINCT
  2. WHERE
  3. AND, OR, NOT
  4. IS NULL, IS NOT NULL
  5. INSERT INTO
  6. UPDATE
  7. DELETE
  8. ORDER BY, ORDER BY <column_name> DESC
  9. CREATE <DATABASE>
  10. DROP <DATABASE>

Advertising

What is SQL Server?

SQL Server is a self-architecture relational database management system (RDBMS) acquired and marketed by Microsoft. SQL Server, which is mostly used in Windows operating systems, became available in Linux-based systems in 2016.

SQL Server consists of two basic components, Database Engine, and SQLOS. [6]

What is MySQL?

MySQL is an open-source, fast, and robust relational database management system (RDBMS) generally preferred on Linux platforms. Encoded in C and C++ languages, MySQL was developed by Michael Widenius and announced in 1995. Since it is open source, it is mostly preferred in the Linux environment.

Originally developed and supported by MySQL AB, MySQL was acquired by Oracle Corporation.

After the relational database idea was introduced, a relational database language called SQUARE was introduced. However, because the subscripts and superscripts used in the SQUARE language made it difficult to use, an easier language was needed. SQL (Structured Query Language), previously known as SEQUEL, was thus developed. In this article, I talked about the concept of SQL, relational database logic, when SQL emerged, how it works and what it does, and what MySQL, NoSQL, and SQLServer are. I hope my post was helpful. If you have any questions, you can send them in the comments section. Best regards.

Ömer Faruk Coşkun - ÖFC
Omer Faruk COSKUN

I am a Computer Engineering student at Istanbul University-Cerrahpaşa. I love to research, learn and also share what I have learned.

Comments

You have submitted more comments than you can post in a given time. Wait a while.
You have submitted more comments than you can post in a given time. Wait a while.
You have submitted more comments than you can post in a given time. Wait a while.
Your comment has been sent successfully. We thank you.
An error occurred while submitting your comment. Please try again later. If the problem persists, please contact us.

Be the first to comment.

Advertising