SQL (Structured Query Language) is a language we use to interact with a Database Management System (DBMS).
As the name suggests, it’s not a programming language, but it was born as a querying language, and later evolved to an interface to doing more advanced operations with a database than just performing queries.
I said “evolved”, but in reality SQL is always evolving. It’s a standard that was first published in 1986, then updated in 1989, 1992, 1999, 2003, 2006, 2008, 2011, 2016 and as its latest version at the time of writing, 2019.
SQL is implemented in many popular DBMS: PostgreSQL, MySQL, Oracle, SQLite, MicroSoft SQL Server, and many more. Each different database implements the standard, or a particular version of it, and adds custom features on top of it, to simplify creating queries or adding a specific functionality.
Unless noted otherwise, every time I talk about SQL I talk about the SQL standard, not a particular implementation of it.
SQL is a huge subject. I will cover many of its topics in different blog posts, including:
- Creating a database
- Creating tables with SQL schema statements
- Populating tables with data
- Modifying a table schema
- Adding or removing columns from a table
- SQL queries
- Using aliases
- Sorting data
- Working with quotes in queries
- Joins between multiple tables
- Calculating data using functions
- Converting between different data types
- Working with date and time
- Concatenating strings
- Combining results using UNION
- Sets (union, intersect, except)
- Grouping and aggregating data
- Ordering data
- Counting data
- Limiting the data you retrieve
- Working with NULL
- Window functions
- Conditional logic
- SQL transactions
- Stored procedures
- Improving performance with indexes
- Using EXPLAIN