SQL 101 Learn SQL. Not too much. Mostly online.

I’ve had people ask me how to learn SQL without installing a database. This past Sunday afternoon I saw a packed class of current and aspiring data scientists learn SQL in a great class taught by Ted Petrou. You can indeed learn SQL for free without installing anything. Let me paraphrase Michael Pollan, well known for “Eat food. Not too much. Mostly plants.” Here’s my suggestion for anyone who works with data:

Learn SQL. Not too much. Mostly online.

Let me explain. If you work with data, you need to know SQL. Even if you have a bias against or don’t use relational database management systems (RDBMS) such as SQL Server, Oracle, and DB2, you still need to know SQL. SQL syntax or similar syntax is used to query all types of data sources, not just RDBMS – thus my advice to “learn SQL.”

There’s a lot to SQL syntax. Just look at the excellent books from Joe Celko and Itzik-Ben Gan. To get started with SQL, it’s important to keep it simple and focus on just the basics. You can learn simple syntax and accomplish a lot – thus my advice for “not too much” so that you don’t get overwhelmed. Ted Petrou recommended starting with SQL Queries for Mere Mortals after learning the basics online.

There are many great free resources for learning SQL. Here’s a site that you can browse to and start immediately. And here’s another. Neither site requires registration. If you are willing to register for free, data.world is a great site for learning SQL. It’s what Ted used in his class. The advantage of data.world is that it has many interesting datasets you can work with.

Why start learning online? Because you can start immediately and not be troubled with installing database software, database tools, and a database itself. Just navigate to the URL and start doing SQL – thus my advice for “mostly online.”

Once you’ve learned a bit of SQL online, you might want to consider installing your own RDBMS. You can download Oracle for free. You’ll probably want to download the free version of TOAD to access your Oracle database. Mac users may want to install MySQL or PostgreSQL. MariaDB is free and available for Mac, Windows, and Linux. For Windows users, I recommend installing SQL Server Express. It’s free and has great, free tools. That’s really important. Your day to day experiences with SQL are going be experienced through the tool you use to access the RDBMS. For SQL Server, the free SQL Server Management Studio (SSMS) is probably your best choice of tool to use. Unlike other free tools such as TOAD, SSMS is full featured. If you want to do something more advanced involving other languages in addition to SQL, you could use Microsoft’s free Visual Studio Community Edition or Visual Studio Code, both available for download from here. Keep in mind that SQL Server 2017 is available for both Windows and Linux. I think you’ll find SQL Server to be particularly user friendly and easier to work with than other products. You can install SQL Server 2017 on Docker running on Windows, Linux, or Mac. Read more about it here. You can also create a SQL Server database in Azure, which is Microsoft’s name for the cloud. When you create an Azure SQL Database, you can choose to have a sample database installed at the same time.

When you decide to have your own RDBMS to learn with, you’ll need a sample database. The classic Northwind and pubs databases are still available, but I think you should consider something a bit newer. The AdventureWorks database is newer, but it is being phased out. As of SQL Server 2016, Microsoft’s recommended sample database is Wide World Importers which you can obtain from GitHub. Of particular interest to data scientists is SQL Server 2017’s support for R and Python. These are advanced topics. To get started learning SQL or improving your data science skills, I’ll go back to what I said before.

About John Paul Cook

John Paul Cook is a database and Azure specialist in Houston. He previously worked as a Data Platform Solution Architect in Microsoft's Houston office. Prior to joining Microsoft, he was a SQL Server MVP. He is experienced in SQL Server and Oracle database application design, development, and implementation. He has spoken at many conferences including Microsoft TechEd and the SQL PASS Summit. He has worked in oil and gas, financial, manufacturing, and healthcare industries. John is also a Registered Nurse currently studying to be a psychiatric nurse practitioner. Contributing author to SQL Server MVP Deep Dives and SQL Server MVP Deep Dives Volume 2. Connect on LinkedInFollow @JohnPaulCook