13th Feb 2020 12 minutes read How Long Does It Take to Learn SQL? Rebecca McKeown learn sql Table of Contents The more you know, the more you know you don’t know. 1. SQL Basics SELECT INSERT UPDATE DELETE 2. SQL Joins 3. The Rest Hurdles to Learning SQL Getting Used to Thinking in Sets Book knowledge vs real-life knowledge Becoming database design savvy What’s the Best Way to Learn SQL? 1. Start with the Basics 2. Take an Online Course 3. Go Heavy on Hands-On Learning Get an SQL Head-Start with Vertabelo Is it hard to learn SQL? How long does SQL mastery take? This article will answer those questions and get you started with the most useful SQL commands. How long does it take to learn SQL? If you’ve ever dabbled in Spanish or French, you know that learning a new language is tough and can take years. Luckily, mastering SQL is a much faster journey than conquering por/para or un, deux, trois. Pinpointing just how long it might take to learn any given thing is difficult. It not only depends on your starting point, but also your openness to new information, competing demands on your time, and your information retention abilities. Some have superpowers for absorbing and remembering new knowledge. Others are more like the lesser-known superhero “Forgets-everything-by-the-next-morning Man”. Joking aside, you’ve come here for a serious answer to a very valid question. Want to understand how fast you can learn SQL? We’ll get to that magic number soon. Just like learning to hard-boil an egg, tie your shoelaces, or boogie like Bowie, learning SQL doesn’t happen overnight. But with a lot of practice – and a few weeks or months of effort – you’ll add SQL to your digital toolbelt in no time. In this article, we take a look at the three main aspects of SQL, a few options as to how to approach your SQL-learning journey, and the hurdles you’ll need to hop over along the way. Just bear these wise words in mind as you go: You don’t have to be great to start, but you have to start to be great. The more you know, the more you know you don’t know. There’s an element of this in every type of learning. Once you’ve immersed yourself in SQL for a while, you’ll begin to realize just how much there is to learn. Don’t be overwhelmed. A solid understanding of the basics will go a long way, even in professional applications. There are three key ‘levels’ of SQL learning. Think about which group you fall into and stay in your lane. There’s no need to reach for the stars right away when there’s plenty of success to be had down here on Earth. Here are our three levels of SQL learning: 1. SQL Basics There’s good news for us time- or motivation-poor folks: Learn SQL’s SELECT, INSERT, UPDATE, and DELETE commands and you’re probably 70% of the way toward being SQL-capable. Better still, you’ll have got to that point of proficiency in a very short time. Here’s a fun little example. Let’s say we’re a superhero temping agency and we have a database of our active recruits and the superheroes we’d like to hire. This table – let’s call it Superheroes – might look something like this: IDNameIsActiveHourly rateEmployeeType 1BatmanTrue10.95Full Time 2SupermanFalse8.50Part Time 3Wonder WomanTrue12.20Part Time 4The HulkTrue18.10Full Time 5Iron ManFalse13.45Part Time 6The WaspFalse10.90Full Time What SQL basics do we need to work with this information? SELECT SELECT is the perfect place for a rookie to start their SQL journey. A SELECT statement looks like this: SELECT * FROM Superheroes Because we’ve used SELECT * (the asterisk * means “all columns”), every column is shown. We could use a WHERE clause to filter out records, but we didn’t; this means that all the table’s rows are returned in our result. IDNameIsActiveHourlyRateEmployeeType 1BatmanTrue10.95Full Time 2SupermanFalse8.50Part Time 3Wonder WomanTrue12.20Part Time 4The HulkTrue18.10Full Time 5Iron ManFalse13.45Part Time 6The WaspFalse10.90Full Time SELECT is almost always used with a WHERE clause, which helps specify the data we want to see. If we wanted to select only the superheroes who work full time, the query would look like this: SELECT * FROM Superheroes WHERE EmployeeType = 'Full Time' IDNameIsActiveHourlyRateEmployeeType 1BatmanTrue10.95Full Time 4The HulkTrue18.10Full Time 6The WaspFalse10.90Full Time INSERT, UPDATE, and DELETE allow users to manage data. Updating or maintaining databases requires a foundational knowledge of SQL, and the INSERT, UPDATE, and DELETE statements will get you very close to your goal of “knowing” SQL. LearnSQL's SQL Basics course takes you through a lot of this foundational knowledge. For now, we’ll just introduce INSERT, UPDATE, and DELETE. INSERT Need to add single or multiple rows to a table? INSERT is what you’re looking for. It can also help you to add rows from one table to another. Here’s the basic structure of an SQL INSERT statement: INSERT INTO tableName (column1, column2, …) VALUES (value1, value2, …) If we wanted to INSERT Spiderman into our superhero database, we’d do this: INSERT INTO Superheroes (Name ,IsActive ,HourlyRate ,EmployeeType) VALUES ('Spiderman' ,'True' ,14.10 ,'Part Time') The result would look like this: IDNameIsActiveHourlyRateEmployeeType 1BatmanTrue10.95Full Time 2SupermanFalse8.50Part Time 3Wonder WomanTrue12.20Part Time 4The HulkTrue18.10Full Time 5Iron ManFalse13.45Part Time 6The WaspFalse10.90Full Time 7SpidermanTrue14.10Part Time UPDATE SQL UPDATE can help you change column values for single or multiple rows. An SQL UPDATE statement is typically structured as follows: UPDATE tableName SET column1=value1, column2=value2,... WHERE filterColumn=filterValue If we wanted to show that Iron Man is now on our books and has a new hourly rate of 18.5, our UPDATE statement and result would look like this: UPDATE Superheroes SET IsActive = 'True', HourlyRate = 18.5 WHERE ID = 5 IDNameIsActiveHourlyRateEmployeeType 1BatmanTrue10.95Full Time 2SupermanFalse8.50Part Time 3Wonder WomanTrue12.20Part Time 4The HulkTrue18.10Full Time 5Iron ManTrue18.50Part Time 6The WaspFalse10.90Full Time 7SpidermanTrue14.10Part Time DELETE DELETE removes one or more rows from a table. If you’re new to SQL, make sure you’re using a test database before trying this command, because often there’s no retrieving what you’ve deleted! DELETE statements generally look like this: DELETE tableName WHERE filterColumn=filterValue; If one of our superheroes comes to an untimely end and we need to remove him or her from our database, we’d do this: DELETE FROM Superheroes WHERE ID = 5 The result? No more Iron Man. IDNameIsActiveHourlyRateEmployeeType 1BatmanTrue10.95Full Time 2SupermanFalse8.50Part Time 3Wonder WomanTrue12.20Part Time 4The HulkTrue18.10Full Time 6The WaspFalse10.90Full Time 7SpidermanTrue14.10Part Time 2. SQL Joins SQL joins add another 10% to your knowledge bank. Joins bring different tables together so the data can be analyzed collectively. Joins are useful if you have different categories of data residing in different tables, or if you want to compare new data to data within an existing database. There are several types of joins in SQL. The basic structure of a join is: SELECT Columns FROM Table1 JOIN Table2 ON Table1.Column = Table2.Column Continuing our example, let’s imagine we want to know which superhero belongs to which Universe. We have a table called SuperheroUniverse, which contains the superhero’s ID and the Universe name. We want to join the two tables so we can show the Universe when we are querying the Superhero table. Our SuperheroUniverse table looks like this: IDSuperheroIDUniverse 11DC 22DC 33DC 44Marvel 55Marvel 66Marvel 77Marvel And our join query looks like this: SELECT Superheroes.ID, Name, SuperheroUniverse.Universe FROM Superheroes JOIN SuperheroUniverse ON SuperheroUniverse.ID = Superheroes.ID Here’s the result: IDNameUniverse 1BatmanDC 2SupermanDC 3Wonder WomanDC 4The HulkMarvel 6The WaspMarvel 7SpidermanMarvel Since both tables have a field called ID, we explicitly had to say which ID column to show in our results. In the Superheroes.ID part of the SELECT, Superheroes refers to the table and ID refers to the column. The same goes for the SuperheroUniverse.Universe part of the SELECT, where SuperheroUniverse refers to the table and Universe refers to the column. You can see that in the first column after the SELECT. 3. The Rest And then there’s the rest. All SQL’s bells and whistles fit into this category, and while they’re certainly not things you need to know at the start, they can be very important. Do you know how to design a workable database schema? How to read a query plan? When to use a natural key or a surrogate key? All these things and more are part of “the rest” category. In terms of time to learn, well, there are people who have been working with SQL for 10+ years who don’t know all of “the rest”. Don’t be put off by this. Learning is a lifelong occupation, and there’s little joy in knowing everything in the blink of an eye. What should an SQL beginner know? You’d do well to get familiar with the following: Basic SQL commands like SELECT, INSERT, UPDATE, and DELETE. Simple WHERE expressions SQL’s many types of JOINs GROUP BY, ORDER BY, and HAVING Basic subqueries Primary keys and foreign keys Feeling overwhelmed? There’s no need to worry. Think of it this way. English language users can be functional speakers with a vocabulary of around 5,000 words. They may even be able to write a novel with this many words. But can they call themselves Shakespeare or Twain? Of course not. Being proficient in SQL doesn’t mean having all the answers. You only need to know about 5% of SQL to do most of the important tasks. Having established that, then, what’s the magic number? How long does it take to learn SQL? Based on our collective experience, a good dose of research, and a sprinkle of generalization, here’s our highly unscientific projection of how long it takes to learn SQL: Learning and practicing the basics? Anywhere from one day to three months. The rest? You’ll never stop learning it. Hurdles to Learning SQL As an SQL beginner – even if you have a great deal of experience in IT – you’ll face a number of challenges. SQL is generally a simple language to learn, especially given that it uses common-sense, English-based commands. There are, however, some hurdles to proficiency: Getting Used to Thinking in Sets It’s one thing to learn SQL in order to manage a database or databases, but first you may find you need to get your head around the world of sets. Databases lie at the heart of most applications and are made to process data in sets. SQL itself must negotiate with databases using sets, so getting into a set-based mindset will take you a long way when picking up SQL for the first time. If you’re not familiar with Set Theory, give yourself a crash Google course on it first – it will set you up for greater success as a student of SQL. Almost all areas of computer science revolve around sets, so paying some attention to this topic now will never be time wasted. Book knowledge vs real-life knowledge The second hurdle to learning SQL isn’t so much a barrier as a trap. To understand SQL, you’ll need to do a lot of reading. You’ll need to read and learn the basic statements, read and learn the basic premises of SQL and how to go about your queries, and read and learn about set theory and database design. BUT, once you’ve done some initial reading, our advice is: get into it. Get into a database (preferably a test one), create or find some scenarios, and use your newfound knowledge of basic SQL statements to play around. The gap between book knowledge and real-life knowledge of SQL is significant, and you’ll need to take care to bridge that gap through plenty of practical exercises. Becoming database design savvy You can get as good as you like at running SQL statements and working with one or more databases. But if you don’t understand the principles of database design, you’ll wind up creating and maintaining messy, issue-prone databases. These databases seem to work against you, not for you. Before you go too far down the SQL highway, pull off to the side and learn a bit about good database design. Many databases are created by people who don’t have a lot of experience in database design and development. Unfortunately, this often leads to technical decisions that later prove suboptimal. This means a lot of frustration, a lot of workarounds, and potentially even errors in the data itself. What’s the Best Way to Learn SQL? No matter how long it takes to learn SQL, you’ll have a better experience if you follow a few pointers. Here are our top three tips for making your SQL learning experience a quick and painless affair: 1. Start with the Basics Learning the more complex aspects of SQL can take years – in fact, most SQL experts say they never stop learning. So don’t jump in expecting to get an SQL gold medal right away. Not only are the basics easy and quick to learn, they’re also a huge chunk of what you’ll need for using SQL in a professional capacity. Everyone’s different, but learning basic SQL statements can take anywhere from a couple of hours to a couple of weeks. It can take months to master them, but once you understand the concepts behind statements like INSERT, UPDATE, and DELETE, you’ll be very well placed to use those statements in the real world. It’s best to stick to the SQL Basics until you feel you’ve mastered them. If you move to composing complicated queries before you’re ready, you may set yourself up for big mistakes later on. 2. Take an Online Course You may be a great self-directed learner, but when teaching yourself SQL from scratch, you run the risk of overcomplicating things. SQL basics are quite simple, and many people have gone before you on this learning journey. The most logical way forward, then, is to follow the well-trodden path and take a course that teaches only what’s necessary and gives you many opportunities for practice. 3. Go Heavy on Hands-On Learning Learning to fly a plane? Perform brain surgery? Split atoms? You’re going to want to do plenty of reading first. But for SQL, the best thing you can do is to jump in and get your hands dirty. Find yourself a free open source database and start composing and running basic queries. If you find a good test database, study it. Check the code underlying different queries and procedures. You’ll find yourself coming to grips with SQL very quickly. Real-world examples in a test database environment are the best training tool. In the immortal words of Ben Franklin: “Tell me and I forget. Teach me and I remember. Involve me and I learn.” (It wouldn’t be an online article without Ben Franklin!) Get an SQL Head-Start with Vertabelo How hard is it to learn SQL? Well, you’ll never really know it all … not completely. Just like you’re still finding new English words, there will always be some new SQL trick to master. Having said that, there’s plenty you can learn, and a broad foundational understanding will set you up to be a bona fide SQL user within weeks. A great place to start is an online SQL course. Find one that will get you using the language right away. LearnSQL.com offers a fantastic SQL Basics course that makes learning SQL quick and easy. Its 129 interactive exercises give you hands-on experience working with databases and SQL statements. Once you’ve worked your way through that, check out our INSERT, UPDATE, and DELETE course. It will expand your new knowledge of key SQL statements. Databases are complex beasts. The best way to tame them is a bit of learning, a lot of practicing, and lifelong Googling. The sooner you start, well … the sooner you’ll get there! Good luck! Tags: learn sql