Introduction to SQL
So, what exactly is SQL? The name SQL is an acronym for Structured Query Language, but is sometimes referred to as "Sequel". SQL is a database querying language used to extract, insert, delete and create records inside relational database management systems or RDBMS. Although SQL has many more operations that can be performed, we will stick with the basics as this is meant to be an introduction to the language.
What is a database?
According to oracle.com, a database is an organized collection of structured information, or data, typically stored electronically in a computer system. A database is usually controlled by a database management system (DBMS). Data is most typically organized in rows and columns which are then put into separate tables in order to make querying them effective. Over the years, databases have evolved substantially from a simple tree-like model that only allowed a one-to-many relationship. Some of the newer, more flexible types of database are relational databases, object-oriented databases, and most recently cloud databases and self-driving databases.
What is SQL and why is it used?
Back in the days before SQL, before the internet, databases used to be kept as actual files in file cabinets. I'm sure its not difficult to imagine how tedious it would be to have to go through a plethora of files in filing cabinets, and manually have to compile the data you wanted as well as transforming it. This is part of the job of SQL. As mentioned above, SQL is used to query databases of potentially millions of pieces of data and return only the relevant information the searcher has specified. Databases can not only contain millions of data entries, but also can have multiple different fields for each entry. This is where SQL can come in handy by returning only the values specified by the person querying the database. For example, if you wanted to query a database of soccer players, but wanted the data returned to be filtered in some way(such as height, name, or weight), SQL could return just that information.
A brief history of SQL
According to Chad Brooks of businessnewsdaily.com,
The SQL programming language was developed in the 1970s by IBM researchers Raymond Boyce and Donald Chamberlin. The programming language, known then as SEQUEL, was created following Edgar Frank Codd’s paper, “A Relational Model of Data for Large Shared Data Banks,” in 1970.
Since its development, according to W3 Schools, SQL has become a standard of the American National Standards Institute (ANSI) in 1986, and of the International Organization for Standardization (ISO) in 1987. The most recent version for SQL was published in 1992 by ANSI.
Basic SQL syntax
Depending on the SQL database you're using, you may or may not need to use the semicolon character. This is because commands in SQL can sometimes span several lines, and some programs require the semicolon to signify the end of a command. As far as case sensitivity goes, SQL as a language is not case sensitive, but uppercase is most frequently used for command lines. There are different versions or dialects of the SQL language, but in order to be compliant with ANSI standards, they all support the major commands. These commands include:
SELECT
The select keyword in SQL retrieves information from one or more than one database tableUPDATE
The update keyword allows you to update information within a databaseDELETE
Allows you to delete information from database(s)INSERT
Allows you to insert information into database(s)WHERE
"WHERE" is used to filter data and return records that meet the chosen condition
Example of "SELECT", "FROM", and "WHERE" taken from w3schools.com:
SELECT column1, column2, ...
FROM table_name
WHERE condition;
On the "SELECT" line of the code example above, the column to be queried is chosen. "FROM" is used to choose which particular table you are trying to access. The "WHERE" condition can be set to return a particular ID associated with the data, or other constraints as mentioned in the intro of this post.
Popular SQL Databases in 2022
There are many SQL databases, but three of the most popular, according to DB-Engines are:
- Oracle:
Oracle is the most widely used SQL database currently, however it is not seen as beginner friendly because the user may need a large amount of SQL knowledge to use the database effectively.
- MySQL:
MySQL is a mostly open source, free-to-use database(Commercial license is required to use for businesses). It is also considered beginner friendly as anyone can download and begin to use MySQL in a short period of time. One of the drawbacks of using MySQL is that it lacks an efficient debugging tool relative to paid databases.
- Microsoft SQL Server:
Microsoft SQL Server has a good source of documentation online, and boasts that it is the most secure database engine over the last 10 years.
What jobs use SQL?
As I'm sure you would expect, software developers hit the top of this list because SQL is so useful for using data from databases to make graphs or keep statistics on web pages and on apps. However, SQL seems to be used widely by many different jobs. Some of these include business analysts, data scientists, financial consultants and many more professions.
Conclusion
All in all, SQL is an extremely versatile querying language, and can be used to do a multitude of different things. It is used for many different things from sports statistics to customer databases to finance. If this blog post has grabbed your interest, I have included a couple videos below that I found to be good introductions to the SQL language.
Helpful Videos
Learn Web Code: MySQL for beginners
Basic Intro/Explanation to SQL
Sources
Business News Daily
Wikipedia
NIST Gov
W3 Schools
Top Databases 2022
DB-Engines Current Rankings
Microsoft SQL Server Info
Top comments (0)