Vertabelo Academy is a great place to learn SQL. If you’re a complete beginner, it’s best to have an overview of what SQL is, what a database is, and how they work together. In this article, you’ll find a quick explanation of all you need to get started with SQL.
You might have already heard that SQL is used with databases. What exactly is a database? In the most general sense, it is an organized collection of various kinds of data. Think of it as a place where you can keep information – e.g. a list of website users’ passwords and profile names; an online store’s transaction history; or a hospital’s patient records. Such information can be stored in various ways: simple text files, spreadsheets, or in databases.
The Database Management System
A database management system (or DBMS) is a computer program, just like an Internet browser or a word processor. A DBMS can configure a database as well as add, delete, and display data. Some popular DBMS programs are Oracle, PostgreSQL, MySQL, Microsoft SQL Server, and SQLite.
You have probably used a spreadsheet program (like Excel). In a spreadsheet, there are columns and rows which you can fill with data. A database is a set of tables that look similar to Excel sheets – they consist of columns that always store one kind of data and rows that hold information about specific items. Below is an example of a very simple table in a database.
|Pulp Fiction||Quentin Tarantino||1994|
|Godfather||Francis Ford Coppola||1972|
When you open an Excel sheet, you can see all the data right away. In order to access data in a database, however, you need to specify what you want to see using a language called SQL.
What Does SQL Do?
IBM invented SQL, or Structured Query Language, in the 1980s as a way to communicate with databases. Although SQL requires a strict syntax, or order of words and commands, it is designed to be human readable. This means that even non-programmers can figure out the meaning of some simple SQL queries. For instance, the statement below…
SELECT title, director FROM movie WHERE release_year=1994;
…tells the database to display the titles and directors of movies (
SELECT title, director) that are stored in the
movie table (FROM movie) and were released in 1994 (
SQL keywords are often written in uppercase for greater readability. You can see some of them in the statement above:
WHERE. Each keyword has a specific meaning and must appear in a certain order for the database to process it.
Advanced SQL statements allow you to create multiple filters, group rows, join tables, calculate averages and sums, and do much more. You can learn all of these skills in our interactive SQL courses.
SQL can be pronounced two different ways. You can either say each letter separately (“S-Q-L”), or say it as a single word (“sequel”). You can find out more about the history of the SQL name by reading S.Q.L. or Sequel: How to Pronounce SQL?
You may have heard that SQL supports all CRUD operations. CRUD stands for Create, Read, Update and Delete, which are the four basic operations in any database. As a database language, SQL can perform all of these operations:
- You can create new data with
- You can read data with
SELECTstatements, as we did in the above example.
- You can update data with
- You can delete data with
SELECT statements are by far the most frequently used SQL statements. This is why we recommend you take our SQL Queries course first if you have no prior experience with SQL. The remaining operations – creating, updating and deleting data – are explained in another course, Operating on Data in SQL.
What Else Can SQL Do?
Aside from accessing and displaying data, SQL can also be used to create new tables in a database. Good table design makes user mistakes less likely. For example, if you tell a database that a column should contain only numbers, it won’t accept a word or any letters. To learn more about how building a table works, check out the Creating Tables in SQL course.
SQL can also control the behavior of your databases: it can create users with specific privileges, create and delete new databases, and describe the tables and columns inside the new databases. However, there are usually slight differences in the SQL syntax among various DBMSes, so you may want to read the documentation of your DBMS before you try these advanced functions.
In many ways, learning SQL is a good place to start working with databases. Continue reading the Vertabelo Academy blog for more information, or try any of our interactive SQL courses for free!