Back to articles list Articles Cookbook
5 minutes read

The Complete Beginner’s Guide to SQL Fundamentals

LearnSQL.com 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 complete guide to SQL fundamentals.

SQL Fundamentals: Database

Let’s begin our guide to SQL with basic definitions. 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.

We also talk about what SQL is on our YouTube channel "We Learn SQL". Check it out. Remember to subscribe.

SQL Fundamentals: Database Management System

Going further with our guide to SQL, 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.

SQL Fundamentals: Database Tables

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.

table: movie

title director release_year
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. That’s where our guide to SQL proceeds to the notion of a programming language.

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 (WHERE release_year=1994).

SQL keywords are often written in uppercase for greater readability. You can see some of them in the statement above: SELECT, FROM and 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.

A guide to SQL cannot omit the pronunciation issue. 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?

CRUD Operations

Another topic from the area of SQL fundamentals are CRUD operations. You may have heard that SQL supports all of them. 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 INSERT statements.
  • You can read data with SELECT statements, as we did in the above example.
  • You can update data with UPDATE statements.
  • You can delete data with DELETE statements.

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.

Beyond SQL Fundamentals

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. Our guide to SQL doesn’t cover this topic, so if you want 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 fundamentals is a good place to start working with databases. Continue reading the LearnSQL.com blog for more information, or try any of our interactive SQL courses for free!