In the original version of this article, I presented the 18 best online resources for learning SQL. After more than a year, I refreshed the list – mainly by adding some recently-released courses. As a result, the article has grown significantly. The “18+” in the title doesn’t mean that this article is adults-only reading. It indicates that you can expect much more than my initial 18 resources.
But let’s get to the point and take a closer look at some of the best online resources that can help beginners get started with SQL.
We’ll start with websites that focus on SQL syntax and basic SQL concepts.
Their online SQL Tutorial guides you through syntax and most important statements, keywords, and functions. Short but concrete descriptions and many examples make this tutorial easy to read and understand.
A distinctive feature is the ability to test queries online. At the start of the tutorial, there is a sample database which you can modify and restore back to its original content at any time. The guide ends with a simple quiz.
The entire tutorial is available without registration.
The “SQL Queries” course starts with simple queries, progressing through GROUP BY queries to advanced topics like subqueries. You will also find out about the subtle changes between various joining methods, including INNER JOIN, LEFT JOIN, RIGHT JOIN and OUTER JOIN. Finally, you’ll have a chance to test your knowledge in a comprehensive quiz.
In the “Operating on Data in SQL” course, you will learn how to manage data in relational databases, i.e., how to insert, update, and delete information from a database.
In the “Creating Tables in SQL” course, you will find out how to manage the structure of a relational database. You’ll learn to create tables and define their various elements, like primary keys, UNIQUE keys, and foreign keys. You will get to know how to use and define constraints. Finally, you will find out how to create views.
Each course features dozens of interactive exercises with a detailed explanation of the theory behind the lesson, and an interactive console that verifies your solution. After completing all lessons, you can take a final quiz to test your knowledge.
You can start the course without registration but you will be asked to sign up after completing the first few exercises. You can register with your email address, or your social profiles (Facebook, Google+, Twitter, or GitHub).
Like all other courses at Codecademy, “Learn SQL” is free and interactive. It covers the basics of database fundamentals: tables, queries, aggregate functions, constructing advanced database queries and more.
The course consists of 4 lessons that focus on:
- basic SQL commands to manipulate data stored in relational databases
- the most commonly used SQL commands to query a table in a database
- using SQL to perform calculations during a query
- querying multiple tables using joins
The user interface of each lesson is divided into three panels. The left one contains a description of the exercise with a brief theoretical introduction. In the center, there’s an interactive SQL command line where the user writes SQL against an SQLite database. The panel on the right features a visual representation of the database schema with the query result.
After completing a lesson, you can test your knowledge with a quiz, or master your skills with a real-world project to teach you how to apply what you’re learning in a hands-on, practical way. Unfortunately, both quizzes and projects are available only for users who have subscribed to a paid Pro version of Codecademy.
In order to participate in the course, you need to register using an email address or a Google or Facebook account.
Khan Academy provides its users with micro-lectures in the form of YouTube videos, lots of practice exercises, and a personalized learning dashboard. Combined, these tools empower learners to study at their own pace inside and outside of the classroom.
Among many courses offered by Khan Academy, you can find a free SQL course called “Intro to SQL: Querying and Managing Data.”
Each lesson consists of two elements. The window on the left is a video tutorial, while the window on the right shows real-time changes in the database structure and the results of queries performed under the SQLite database. Exercises are supported by documentation and useful hints. After finishing the first part of the course, learners complete a more advanced project.
The whole course contains 5 parts, starting with SQL fundamentals. It continues with constructing more advanced SQL queries using operators (such as AND/OR, IN, LIKE, etc.) and joins. An ending section called “What to learn next” provides useful tips and links.
Khan Academy allows users to watch videos without registering; however, after registration (via Facebook, Google, or email) they can ask questions regarding videos and participate in discussions.
The course features live interpreters and interactive exercises for multiple types of databases, such as MySQL, PostgreSQL, Oracle, SQL Server, and DB2.
This site has three major sections: Tutorials, Assessments, and Reference.
A tutorial is a set of exercises that aims to acquaint you with new topics. You start with SQL basics, then go through nested SELECT statements and aggregate functions (such as COUNT, SUM, or AVG), ending with more advanced JOIN operations. At any time, you can consult the Reference section for background on the appropriate theory, explained with interactive examples.
After completing each tutorial, you can take a quiz to show how well you understand the topic.
The Assessments section offers several mini projects; each includes 15 questions of varying levels of difficulty.
The course is available without registration, however, you can create an account with your email. This is recommended if you want to publish comments or contribute to the site.
Tutorials Point claims to be the web’s largest library of tutorials. Indeed, it offers dozens of online courses in computer engineering, information technology, programming languages, and management.
The “Learn SQL” tutorial provides a nice guide to basic SQL, its most useful functions, and more advanced topics. There are plenty of easy-to-understand examples, but no interactive exercises to practice what you have learned.
It’s worth mentioning that you can download the whole tutorial as a PDF file to get back to it at any time, even when offline.
Udacity offers interactive online courses aimed at advancing academic and vocational skills. Although Udacity is profit-oriented, some courses are available for free.
One of its free courses is “Intro to Relational Databases”, which provides the learner with the basics of SQL and database design. Since the course uses examples and programming exercises in Python, you’ll also get to know the Python API. For this reason, Python fundamentals are required. You don’t need any previous database experience since this course is an entry-level introduction to relational databases.
The course consists of video lessons, and each lesson includes a final quiz. The lessons are divided into four parts:
- Relational Concepts
- SQL queries
- Python DB-API (accessing a relational database from Python code)
- Advanced SQL (joins, normalization)
The course ends with a project that focuses on building a database-backed Python module to run a game tournament.
You don’t have to register to preview the course, but if you want to get full access, you must sign up with your email, Google, or Facebook account.
SQL Problems and Solutions is an interactive textbook which lets you visualize tables and execute queries against a sample database. The tutorial explains the basic concepts and constructs of SQL and provides examples at various levels of expertise.
Once you get familiar with SQL, you can practice your skills on the sister site “SQL Exercises”. Here you can build and test your SQL DML statements: there are exercises for retrieving and modifying data using the SELECT, INSERT, UPDATE, and DELETE statements.
You can read the entire textbook without registration, but if you’d like to write your own queries in the interactive SQL console and execute them against sample databases, you’ll need to sign up with your email address.
Tuts+ offers video courses and written tutorials that teach a wide range of creative and technical skills, including coding. Unlike video courses, all tutorials and articles are completely free. Based around specific projects, they include step-by-step written instructions and screenshots to help you practice and master your skills.
Among over 20,000 free tutorials, there’s a pretty good one that teaches SQL. In fact, this is more of an article than tutorial. It consists of two parts: “SQL for Beginners” and “SQL for Beginners Part 2.” The first article includes an easy-to-grasp explanation of basic SQL queries, complete with many screenshots. In the second article, users learn about indexes, data types, and some rather more complex query structures.
Both articles are available without registration.
Essential SQL, authored by Kris Wenzel (@sqlkris), is a great place to learn the fundamentals of SQL and database concepts. The course is based on Microsoft SQL Server, which is why the author provides newbie users with a guide on how to get started using this database engine.
The tutorial presents free tools to get you started, a guide leading you through the setup process, step-by-step explanations of how to download and activate a sample database, and much more. You’ll get to know how to create simple select and sort queries, introduce yourself to SQL Server’s built-in function, learn how to normalize your database, and much more.
An especially great thing with Essential SQL is that Kris is personally involved in the teaching process. When there are problems or doubts, he strongly encourages readers to contact him.
A significant drawback of this course is its lack of a structured learning program. It’s more an extensive collection of articles covering a wide range of SQL-related topics than a step-by-step tutorial.
Most of the articles are available without registration; however, some content requires users to sign up with an email account.
The essence of this course is perfectly described by the following review: “This book will teach you the 80% of SQL you probably need to use it effectively, and will mix in concepts in data modeling at the same time.”
Indeed, the tutorial looks much more like a story, where each chapter has some theoretical content, related questions, and exercises. You can learn the basics of creating and manipulating tables, get familiar with data migration, and start understanding data manipulation and transactions.
To keep the book simple, the site uses SQLite3 to teach you how to design data and work with it.
Right now, there’s an HTML ALPHA version of the book available, so users will have to wait for the final chapters to be completed.
The entire contents of the website is available without registration.
Udemy is a leading global platform where experts create courses and offer them to the public, either at no charge or for a tuition fee.
Udemy provides various database and SQL video courses designed for particular database engines, including MySQL, Oracle, and MS SQL Server. There are several free SQL courses for both beginners and advanced users.
Here are some free courses worth checking into:
- Introduction to Databases and SQL Querying
- MySQL Database For Beginners
- SQL Server For Beginners
- HANDS-ON SQL For Beginners (SELECT, FROM, & WHERE)
- Sachin quickly learns SQL
To start learning, you must register with your email address.
This website provides users with a set of tutorials on managing MySQL databases and manipulate data. With various techniques – such as SQL queries, MySQL stored procedures, database views, triggers, and more – the tutorials shows how to deal with common tasks in MySQL.
The Basic MySQL tutorial helps you get familiar with the fundamentals, including managing databases, creating tables, querying and modifying data using various MySQL statements and other constructs.
In the MySQL Tips section, users are provided with advanced techniques and tips to help them solve the most difficult challenges in MySQL effectively.
Other tutorials give in-depth background information on:
- MySQL stored procedure,
- MySQL triggers,
- MySQL views,
- MySQL full-text search,
- MySQL functions,
- MySQL administration.
All tutorials are available without registration.
SQLCourse provides easy-to-understand SQL instructions and allows you to practice what you learn with an on-line interpreter. With these tools, you can create your own unique tables and perform selects, inserts, updates, deletes, and drops – in other words, you’ll learn the basics of SQL by doing it yourself.
When you complete the basic training, you can continue developing your SQL skills with SQLCourse2. This course gives you an introduction to important advanced features and clauses of the SELECT statement that weren’t supported in the previous part.
The resources of both websites, SQLCourse and SQLCourse2, are available without registration, however, you can sign up with your email to get free access to newsletters, whitepapers, and other premium contents.
The site related to SQLCourse and SQLCourse2. Although it looks old-fashioned, Database Journal is a great comprehensive source of knowledge. There are lots of database articles, news pieces, and tutorials regarding MS SQL, Oracle, DB2, MS Access, and MySQL database management systems.
You don’t have to register to take advantages of this website, but you can sign up with your email to get free access to newsletters, whitepapers, and other premium contents.
* * * * *
The following resources cover database fundamentals and usage.
“SQL for Web Nerds” is a free online book written and distributed by MIT professor Philip Greenspun. Some of you may be familiar with this book, since it’s required reading for many university database classes.
“SQL for Web Nerds” teaches relational database management systems from the perspective of a web application developer rather than from a theoretical point of view. It covers basic database concepts such as ACID and how RDBMS work; provides examples of simple and complex queries, transactions, triggers, and views; and tackles issues like having Java executing inside an Oracle Server, handling foreign and legacy data, and normalization. Note: The SQL examples given in the book are for the Oracle database.
All of this is presented in a light way, with well-thought-out examples. Photographs illustrating the author’s concepts enrich the tutorial.
The entire website is available without registration.
This course covers database design and the use of database management systems for applications. It’s where you can find self-paced mini-courses or one collective “Introduction to Databases” course that contains all mini-courses and a no-SQL review.
Courses are taught by Professor Jennifer Widom, co-author of four academic books covering beginning and advanced introductions to database systems.
In brief, these courses cover: Introduction to relational databases, Querying Relational Databases and XML Databases; Database Design; and SQL Advanced Features.
The Stanford Database Course has four major elements: Courseware, Readings, Discussion Forum, and Wiki. The main materials are found under Courseware: surveys, video lectures with transcripts, quizzes, and exercises. Suggested supplementary readings and other pointers are found under Readings.
If you want to enroll the course, you must register for an account in the Stanford online learning system.
* * * * *
The following resources focus on learning through fun.
Who said that the learning process has to be completely based on tutorials? It could also be fun! So if you are keen on computer games and want to learn SQL, this one is definitely for you.
Briefly, Schemaverse is a space-based strategy game implemented entirely within a PostgreSQL database. Players start on their home planets, where they can build new spaceships and mine resources that can be used to create or upgrade additional spaceships. After completing their own fleet, they can expand across the universe and conquer planets belonging to other players. To command their fleet and compete against others, the gamers must use raw SQL statements.
It’s not only beginners who can find something here. Indeed, some more advanced in PostgreSQL will definitely enjoy playing Schemaverse. As a result, the gamer will not only be fluent in basic SQL, but they’ll also get acquainted with PL/pgSQL.
To participate in the game, you must sign up with your email.
Ready for another fun approach to learning? This one is a galaxy manipulation application, where you can run queries against galaxy database model created in SQLite. The course provides a virtual teacher, Professor Alfred T. Guru, who introduces you to basic SQL syntax.
The course starts with an explanation of SELECT statement, goes on through transactions, and ends with indexes. Each chapter, along with a detailed explanation, contains an exercise that puts the theory into practice. Basically, the exercise relies on writing an SQL query in the editor below the galaxy map. After completing the task, the user gets the query results or, in case of errors, receives helpful, human-readable error messages.
In addition to online course, there are downloadable desktop versions available for Windows, OS X, and Linux.
The tutorial is available without registration.
* * * * *
Following are links to online documentation for some databases.
Although SQL statements typically aren’t much different between SQL dialects when writing simple queries, it’s important to be aware of the documentation for your dialect of SQL and use it often. Here are the common dialects’ references:
- MySQL documentation
- PostgreSQL documentation
- DB2 SQL reference
- Oracle Database SQL reference
- SQLite – SQL Syntax
* * * * *
Online tools to practise and improve SQL skills
SQLfiddle is the perfect tool to test queries, compare and contrast SQL statements in different database back-ends, or when you don’t have a particular database platform readily available but would like to see what a given query would look like in that environment.
Vertabelo allows you to design your database structure for most popular database engines, including PostgreSQL, MySQL, Oracle, SQL Server, SQlite, and IBM DB2. Here, you can put into practise what you learned about database modeling concepts. At any time you can generate an SQL script that creates/removes all elements in your database or removes the selected elements/constraints.
Vertabelo checks your model before SQL script generation and notifies you of any errors or warnings. You can run the script in a particular database or in SQLfiddle and play with it there.
Here you have a sample interactive database model created in Vertabelo. If you’d like to try out how it is to model a database online, just click the “Edit model” button. It’s free and no registration is required.