SQL for Dummies: How to Learn SQL From Scratch in 30 Days or Less (for Free)


Share this post:

During the last three months, I learned to code in SQL (for free). I went from an absolute newbie to intermediate status using free resources on the internet. In this guide, I'll show you how to do the same, in 30 days or less.

Something you should know about learning SQL: If you commit to the process, you’ll be surprised by how much you can learn in a short period of time. Not only that, but your job prospects will improve. SQL coders make excellent money and they're in demand. According to Payscale.com, first-year SQL developers earn about $53,000. Developers with 20+ years earn about $100,000 per year.

The goals of this guide are to (1) arm you with rock-solid motivation to learn SQL; (2) provide the context required to begin your SQL journey; and (3) give you a simple, study plan to master SQL like a boss.

To achieve these goals, I’ll walk you through the following:

  1. Getting Pumped Up to Learn SQL
  2. What You Should Know Before You Begin
  3. A Proven Study Plan for Learning SQL in 30 Days or Less
studying_t20_LAYX0n.jpg
Anyone can learn SQL for free

(1) Getting Pumped Up to Learn SQL

While learning SQL, you'll be solving coding puzzle after coding puzzle. The puzzles build upon each other and the process is fascinating – even thrilling – as this SQL newbie confirms:

You might be thinking, “What? Aren’t databases boring?” Well, if you find Excel pivot tables to be exciting, SQL is like the thrill of hang gliding off a mountain. 

Adventures aside, can you imagine the way SQL can elevate your superhero status at the office? Craig Kerstiens summarizes the essence of why becoming an SQL “superhero” is the most valuable things he ever did:

“SQL is an under-learned skill, the majority of application developers just skip over it. Because so few actually know SQL well, you can seem more elite than you actually are.
In past companies with hundreds of engineers, I’d get a question several times a week from junior to principal engineers of: “Hey can you help me figure out how to write a query for this?” Because you’re skilled at something so few others are, you can help them out, which always makes life a little easier when you have a question for them.”

Even more interesting is how the language increases your “economic mote.” According to data scientist Nishant Upadhyay:

“SQL increases your economic moat  a term popularised by Warren Buffett to describe your competitive advantage against others in your field. SQL is one of the most in-demand skills in the market right now and it is something that will surely set you apart from your peers.

(2) What You Should Know Before You Begin

Most people want to jump head-first into their first SQL course – I certainly did – but first, you need a little bit of context. Before you begin, you should know the answers to the following:

  • What is SQL?
  • What does SQL code look like?
  • Why should people learn SQL?
  • What are the different SQL databases?

If you know this stuff already, skip to the next section. Otherwise, let's brush you up on the basics:

What is SQL?

SQL is the language of relational databases. A relational database is a repository of information organized into tables. A table in a database consists of columns and rows that form strictly-labeled boxes with information inside them.

Imagine an Excel spreadsheet. The columns and rows of a table in a relational database aren't that different. The thing is, a relational database usually contains many such tables, and they can be massive – so big that you couldn't manage all of the information in a series of Excel spreadsheets. In this video, the presenter teaches strategies for managing 80-terabyte SQL databases, trillion-row SQL tables, and backing up petabytes (1,000,000 gigabytes) of information.

Ultimately, structured Query Language (SQL) allows you to access and manage the information in relational databases. Most importantly, SQL lets you query databases to gain vital insights – usually to make important business decisions.

The data you query from a database can be valuable. You might write a SQL query to find out how many chicken breasts your restaurant franchises in Hawaii required last May and June. The answer would help you plan food orders for the following summer. That way, you don't waste money on supplies you don't need.

What Does SQL Code Look Like?

SQL has a unique "markup" or "code" that developers use to write queries and manage the database and tables. SQL code uses a variety of "statements" and "clauses" to pinpoint the information you want to query. For example, if you wanted to query the information about chicken breasts (mentioned above), you'll need the following statements and clauses:

  1. SELECT statement: Indicates what columns of information to select.
  2. FROM clause: Indicates the table of information to query.
  3. WHERE clause: Indicates the rows of information to target.

Here's how the SQL query looks for the chicken breast information. Can you intuit how this query uses the three statements and clauses mentioned above?

SELECT SUM(amount ordered) 
  FROM orders 
    WHERE item = 'chicken breast' 
      AND month IN ('May','June')
      AND year = '2018';

This query produces a numerical value that equals the number of chicken breasts your Hawaiian franchises needed in May/June 2018.

Here's another example: Imagine you want to know how much it would cost in euros to buy everyone in Germany and Spain a coffee if it's €2.00 per cup). In the example below, you'll notice the query has some new commands like:

  • CONCAT: To put the euro (€) symbol in the result
  • SUM: To add the populations of Germany and Spain
  • AS: To label results column "Coffee Cost"
SELECT CONCAT('€', (SUM(population)*2.00)) AS 'Coffee Cost' 
  FROM world
   WHERE name IN ('Germany', 'Spain');

If you want to try this query for yourself, and see how much the coffee will cost, go to the first lesson on SQLZoo.net, and copy/paste the query into the first form. That's a lot of coffee!

Queries get more complicated than this. Here's a complex query that's beyond my skill level. If you get proficient enough to understand it, I'll buy you a cup of coffee to celebrate (please, Germany and Spain, that's not an invitation).

Why It's Important to Learn SQL

There are two main reasons why SQL is important to learn:

(1) SQL for Software Developers: Developers use programming languages (like Python, Ruby, PH, etc.) to build websites and applications. However, websites and applications need to interact with databases, but in most cases, databases only accept commands in SQL. Therefore, even if you're a Python developer, at some point in time, you'll need to work with SQL.

(2) SQL for Business Intelligence and Querying Data for Important Information: In business, better insights result in a better understanding of what's happening and more successful decisions. The same is true in academia, law enforcement, statistics, big data, and many other applications. Here's a list of professions that might rely on insights pulled from SQL databases on a daily basis:

  • CEOs
  • Company decision-makers
  • Researchers
  • Marketers
  • Public relations specialists
  • Advertisers
  • Accountants
  • Statisticians
  • Business strategists
  • Doctors
  • Nurses
  • Big data analysts

These professionals might not know how to code in SQL themselves, but they might need to rely on someone who does. Long story short, understanding SQL makes you infinitely more useful on the job. And considering that it only takes a month to learn the basics, adding SQL to your resume is an easy way to make you more attractive to employers.

man-submit-resume-to-employer-to-revi...
SQL skills look GREAT on a resume

What Are the Different SQL Databases?

There are a number of SQL database systems. Here are three of the most popular:

  • MySQL: MySQL is an opensource database system owned by Oracle. MySQL is free for any business or individual to use, and it's particularly popular as a database for web-based applications. Oracle Database also has an advanced version of MySQL with additional features, which businesses can use by paying a subscription fee.
  • PostgreSQL: PostgreSQL is another free and opensource database system. It's popular among companies that need to handle massively large databases and complex queries, and it's particularly devoted to using "pure" or "standard" SQL.
  • Microsoft SQL Server: Microsoft SQL Server is another popular variant, but it isn't free. Businesses subscribe to use this SQL database system, which is particularly useful for consumer software applications and web applications. The SQL markup used with Microsoft SQL Server has some unique variations from "standard" SQL.

To interact with these databases, you can use a variety of database clients depending on your system and the type of database. Some of these clients are free and open source. Click the links to read our blog articles about them:

I should also mention that SQLBot pairs well with these clients because it lets you preschedule SQL queries in advance, and automatically push the results to you and your team by Slack or email.

(3) Your Proven Study Plan for Learning SQL in 30 Days or Less

Without further adieu, let's start learning SQL. I want you to take 20 minutes right now to complete the first lesson on SQLZoo.net here, Come back when you're done. If you get stuck, use the cheat mode, but only if it's necessary.

-------- 20 Minute Break for Completing the First Lesson on SQLZoo --------

Now that you have finished the first lesson, let's review your SQL study plan which includes three phases. After completing the first two phases, you'll have a solid foundation in SQL, good enough to get an entry-level job. In fact, that's what I ask you to do in phase three: Seek a part-time SQL-coding job.

(1) Complete the Entire Course at SQLZoo.net

In the first phase, you'll complete the SQLZoo.net course. This free, online course has been around for 20 years and many SQL gurus learned to code with it. It has you learning by doing, writing SQL queries from the very beginning.

Complete all 12 lessons and their corresponding quizzes on SQLZoo. Then go through the "Reference, How to..." section. By the end of these sections, you'll be able to (1) query databases, (2) create and modify databases, and (3) import databases into MySQL.

It took me 18 to 20 hours of dedicated study time to complete the SQLZoo course, and I think I was moving pretty slowly. I recommend working on it in chunks, by dividing your study time into three 6-hour days to get through it as quickly as possible. If you decide to retake the course (I do recommend completing it twice) it shouldn't take you more than six or seven hours. Trust me, it's worth it!

Read about my experience using SQLZoo here. I offer some useful tips for getting through the course.

sqlzoo
SQLZoo is amazing.  Free, awesome, and helpful.

(2) Complete 2 More Free SQL Courses from SQLCourse.com

In the next phase of learning, you'll move onto the two free courses from SQLCourse.com:

Work through these courses in long chunks of time like you did with SQLZoo. In these courses, you'll encounter the same concepts you learned in SQLZoo, and you'll cover concepts like aggregate functions, combining conditions, Boolean operators, table joins and more. If you feel like you need additional review, repeat SQLCourse2. Remember, repetition is a good thing while learning SQL because it makes the language feel like second nature.

With the right focus and dedication, you can complete the first two steps in 30 days or less. Then it's time for SQL graduate school: Search for employment that uses your SQL knowledge.

SQL Course
SQLCourse.com also offers free SQL lessons

(3) Search for Employment that Uses Your SQL Knowledge

Using SQL on a daily basis is the best way to skyrocket your coding skills. That's why phase "3" of your learning process involves finding a part-time job that uses your SQL knowledge. This is your graduate school. To help you prepare for the job interview, make sure to read this blog post: SQL Interview Questions: 13 Top Questions You Need to Cram For.

Search Indeed.com for entry-level SQL jobs that you can do remotely from home. Don't focus on pay. Focus on practice. That this part-time job is the final stage of your SQL learning journey. The extra cash it brings is just a bonus! What you need more than anything is experience practicing with SQL. After a few months of practice, you can demand a much higher salary.

As word of encouragement, for your job search, take this message from software development engineer, Shantanu Vichare, to heart:

Of course! Learning SQL could land you a job in the Database Industry. To be good At SQL might depend on how many hours a day you put into learning. Knowing and implementing the concepts will be a fast way to learn and understand SQL faster. I would say a month to learn the basic concepts if you are completely new to SQL. And then if you further want to learn Database Administration that might take a few more months as the scope is wide. Mind me, learning SQL could be fruitful if you want expertise in it.
Keep Learning!

You now have all the tools to learn SQL at your fingertips. If you immerse yourself in SQLZoo and SQLCourse, 30 days from now you could be punching out code while earning extra money in a part-time, remote SQL job. If you have any questions during your learning journey, please don't hesitate to send me a note.

A Final Tip From the SQLBot Team

Now that you're on your way to becoming a SQL guru, you might want to check out SQLBot. This handy tool lets you schedule SQL queries in advance, and have the results sent to your team by Slack or email. Not only that, but SQLBot lets you query your databases directly from Slack on your smartphone, any time, anywhere.

If you want to give SQLBot a try, click this link and create a free account now.

jeremy-hillpot.jpg

Fascinated by emerging technologies, data science, SQL, and the laws and market trends that follow them, Jeremy Hillpot is a freelance technology writer whose background in consumer fraud litigation provides a unique perspective on new technologies in the fields of data science, investments, tech, cryptocurrency, and the law.