9 votes

Recommendations to learn SQL?

I read the AskReddit thread on "What costs less than $100 that changed your life?" (link unavailable since I'm at work) but someone responded "SQL" - jobs just open up that make a ton of money.

I did a cursory search on Indeed and holy moly they were right -- SQL jobs get easily 2x what I make now. I'm pretty good at Excel and that sort of thinking, so I was thinking I'd try taking a class.

Do yall have any recommendations as to a good course to take in SQL, preferably online, preferably free or cheap? I'm willing to pay a bit if it'll mean I can make a lot more, but I'm currently not making a ton, haha.

Any responses welcome, including ideas as to how to break into like, tech-oriented fields as well.

25 comments

  1. [7]
    Akir
    Link
    I'm just going to be "that guy" and tell you to RTFM. In all seriousness, pick a database and read the manual, and for each chapter try to implement what you've learned. Pretty much every database...

    I'm just going to be "that guy" and tell you to RTFM.

    In all seriousness, pick a database and read the manual, and for each chapter try to implement what you've learned. Pretty much every database I've ever used has excellent documentation. Though that being said, there are two glaring exceptions to the list of databases that I have used - Oracle and IBM DB2. There are a lot of people who dislike these databases, but because of that you might have better luck finding jobs with companies who are using them. Doubly so if you invest in certification. Techs who tinker with MySQL are a dime a dozen but Oracle certified DBAs are self-evidently valuable.

    I would suggest if you have a computer with Windows on it that you might start off with Microsoft SQL. There's a free version you can try out with all of their management tools, it's pretty easy to use, and it's got some fairly advanced features behind it that you are likely to find in production environments even if they are not using MSSQL.

    I should mention that there are a few things that you will likely not learn from the manuals that are very valuable to know, but they are actually very simple concepts. Depending on exactly what job you are looking for, you might not even need to know them. But here's the shortlist:

    • Don't delete, invalidate
    • Do everything in transactions so you can roll back any mistakes you might make.
    • Don't run experiments on a production database
    • Understand what normalization is
    • Know how to balance normalization and efficiency
    • If you want to be the master, you can memorize the normal forms. You probably don't really need this one though.

    Of course, there are many other things you will eventually learn with practice, many of which will be dependent on the database you end up learning.

    13 votes
    1. [5]
      skybrian
      Link Parent
      Yes, that would be the way to get on the path of really learning a database well and maybe eventually being a database administrator, but a lot of people need to learn a little bit of SQL for part...

      Yes, that would be the way to get on the path of really learning a database well and maybe eventually being a database administrator, but a lot of people need to learn a little bit of SQL for part of their job and that can be very valuable too, without necessarily deciding to change careers. Which is why so many people do it.

      The basics are the same everywhere and to begin with, you don't necessarily need to get too deep into the details, which is why I suggested some online environments to start. Beyond that, every database vendor has their own dialect of SQL and you usually end up learning whatever your company uses.

      It's somewhat rare to write an application to work with more than one database vendor, but at one time I had a job adapting a Java tool to work with several different kinds of databases. I found learning DB2 to be especially weird because the IBM manuals, while pretty comprehensive, were written in their own dialect of computerese from the mainframe era. But that was before Google and Stack Overflow.

      These days in the open source and startup worlds, PostgreSQL is the default choice. It is what Tildes uses, for example. Microsoft SQL is common in Windows shops, and if you're starting from Excel maybe that makes the most sense. I would be a bit worried that specializing in Oracle or DB2 would be limiting yourself to large, stodgy old companies, and Oracle especially has a terrible reputation that goes way back. But sure, there are people who make a career of it.

      6 votes
      1. [2]
        Akir
        Link Parent
        I wrote my comment with the assumption that @acdw was looking to get a job as a DBA or something similar, where you are going to need that in-depth information that is going to be specific to the...

        I wrote my comment with the assumption that @acdw was looking to get a job as a DBA or something similar, where you are going to need that in-depth information that is going to be specific to the specific DBMS you are using. But yes, if you are just going to do something adjacent you certainly don't need to know everything. Heck, half the time you don't even need to actually need SQL, like when your data is being managed by an ORM or through an API.

        I absolutely adore Postgres, and I would certainly encourage anyone to use it for most projects - especially if it's an open-source project. But there are many shops still running MySQL and a surprising number of them with MariaDB. I mention Oracle and DB2 specifically because @acdw was interested in learning SQL for making money and you're probably going to be able to get the highest paychecks administering these databases. But of course, the best way to figure out where to start is probably just to look at what the job market is like - especially if they want to work locally at an office.

        5 votes
        1. acdw
          Link Parent
          maybe one day ... but I honestly didn't even think about titles or anything like that, or even what the landscape looked like. I could probably start with basic info to get my feet wet then...

          get a job as a DBA or something similar

          maybe one day ... but I honestly didn't even think about titles or anything like that, or even what the landscape looked like. I could probably start with basic info to get my feet wet then transition into manuals for specific software.

          Postgres ... MySQL ... MariaDB ... Oracle ... DB2 ...

          Thanks for the names of all these! They're good to know.

      2. [2]
        daturkel
        Link Parent
        Adding on to this, the disadvantage of learning SQL "from the book" is a common one when you're learning SQL: you don't have a database to practice on. There are luckily a lot of online tutorials...

        Adding on to this, the disadvantage of learning SQL "from the book" is a common one when you're learning SQL: you don't have a database to practice on.

        There are luckily a lot of online tutorials that provide you with a toy database to use as you progress (datacamp and codeacademy both have it I believe). I'd recommend "getting your hands dirty" rather than getting too bogged down with some of the more academic points (relational algebra, etc.) if you want to know just enough SQL to be dangerous.

        3 votes
        1. Akir
          Link Parent
          Someone also compiled this excellent list of publicly available datasets: https://github.com/awesomedata/awesome-public-datasets There's no better example than real-world examples, after all.

          Someone also compiled this excellent list of publicly available datasets: https://github.com/awesomedata/awesome-public-datasets

          There's no better example than real-world examples, after all.

          1 vote
    2. acdw
      Link Parent
      Honestly, thanks! I honestly didn't even think about how databases have manuals telling you how to use them. So RTFM is great advice :) The bullet points you provided are also great for a...

      I'm just going to be "that guy" and tell you to RTFM.

      Honestly, thanks! I honestly didn't even think about how databases have manuals telling you how to use them. So RTFM is great advice :)

      The bullet points you provided are also great for a beginner, so thank you!

      2 votes
  2. [6]
    skybrian
    Link
    It's been many years since I learned SQL in school, so I don't know what online courses are available. But an alternate route might be to read a few tutorials and try it out online? Here are a...

    It's been many years since I learned SQL in school, so I don't know what online courses are available. But an alternate route might be to read a few tutorials and try it out online? Here are a couple of websites that will let you play with SQL queries:

    https://www.w3schools.com/sql/trysql.asp?filename=trysql_asc

    http://sqlfiddle.com/

    8 votes
    1. [5]
      Gaywallet
      Link Parent
      W3 is a good place to start with the basics. @acdw, I would also highly recommend installing a local copy of mysql and downloading public data and using public data sets to create queries to...

      W3 is a good place to start with the basics. @acdw, I would also highly recommend installing a local copy of mysql and downloading public data and using public data sets to create queries to cement it. It frankly doesn't take a very long time to learn, but practice on some of the basics is necessary to get a job most places as the questions they'll ask you during a tech screen are fairly basic to anyone who's programmed in SQL but almost always go over the heads of people who only learned it from a manual.

      If you'd like I could also share the basic concepts from the questions we use on our tech screen.

      4 votes
      1. [4]
        acdw
        Link Parent
        Great advice, thank you! Yes please, if it's not too much trouble :)

        I would also highly recommend installing a local copy of mysql and downloading public data and using public data sets to create queries to cement it.

        Great advice, thank you!

        If you'd like I could also share the basic concepts from the questions we use on our tech screen.

        Yes please, if it's not too much trouble :)

        1 vote
        1. [3]
          Gaywallet
          (edited )
          Link Parent
          Primer: We have a test database. Many of our questions start with a given set of SQL and people are asked to fix it rather than write out SQL from scratch. People often assume (incorrectly) that...
          • Exemplary

          Primer: We have a test database. Many of our questions start with a given set of SQL and people are asked to fix it rather than write out SQL from scratch. People often assume (incorrectly) that portions of the SQL are just done correctly, such as the joins themselves.

          Basic concepts:

          1. Left join vs. inner join. This is almost always the first thing we test (we have a few diff versions of the tech screen). The general idea here is that you should never assume that any foreign key is appropriately populated or that there will always be a record in both tables. You might have an ID that's entirely missing from a look-up table that's supposed to be the source table.
          2. Date fields vs time fields. One of the questions will ask for dates in a particular time frame but attempt to filter a time field between certain dates. Understanding how a date filter works on a time field is important. For example, if I filter to all encounters <= '12/31/2019' and the field has a value of 12/31/2019 08:00:00, will this be filtered out or not?
          3. Where clause vs. join to filter data. We have a question which asks to pull back all records which have something in quarter one but not quarter 2. You should understand how to address pulling records from a table with a multi-clause condition.
          4. Multi-clause where filter including or. We have a question where we ask to filter to two sets of data such as in quarter 1 and with this particular individual or in quarter 2 and of a certain type. You should understand how to group together clauses to create a multi-clause filter and understand how the or clause is evaluated.
          5. Something which requires a subquery or a common table expression. There is a question to ensure that people understand how to utilize subqueries (or alternatively use a CTE).
          6. Aggregation. There is a question to check if people understand how aggregated functions like SUM() and AVG() work. This is often combined with other simple concepts like CASE/WHEN statements.

          Generally speaking we don't get too complicated on the actual tech screen, and concepts which I would consider advanced are asked in a free-form style during the on-site interviews. The above is usually more than adequate enough to understand how well someone grasps SQL and how much they have worked with it. We encourage our participants to explain what they are doing while they are doing it and are watching their screens as they actually type in the answers - this gives us insight into what they try first, how they debug problems, etc.

          6 votes
          1. [2]
            acdw
            Link Parent
            Thanks so much for the write-up! It gives me a great idea of the kinds of things to look for when studying.

            Thanks so much for the write-up! It gives me a great idea of the kinds of things to look for when studying.

            2 votes
            1. Gaywallet
              Link Parent
              Cheers and good luck. Happy to answer any questions you might have along the way.

              Cheers and good luck. Happy to answer any questions you might have along the way.

              1 vote
  3. [3]
    Deimos
    Link
    I don't have any personal experience with the book, and it's definitely not a recommendation for everyone (I checked whether you've posted in ~anime), but I've seen quite a few positive opinions...

    I don't have any personal experience with the book, and it's definitely not a recommendation for everyone (I checked whether you've posted in ~anime), but I've seen quite a few positive opinions of The Manga Guide to Databases. It seems like it teaches the fundamentals in a more interesting way than a lot of other options.

    4 votes
    1. bonbon
      Link Parent
      This is a good book to read. I highly recommend reading this if you want a fun introduction to databases.

      This is a good book to read. I highly recommend reading this if you want a fun introduction to databases.

      4 votes
    2. acdw
      Link Parent
      Put it on hold at the library yesterday, and it's already in! I'm going to start on this tonight :) Thanks!

      Put it on hold at the library yesterday, and it's already in! I'm going to start on this tonight :)

      Thanks!

      1 vote
  4. [2]
    Comment deleted by author
    Link
    1. acdw
      Link Parent
      These are great! Thank you :) I'm really excited for the story.

      These are great! Thank you :) I'm really excited for the story.

      1 vote
  5. [6]
    Icarus
    Link
    I have used this resource in the past: http://sol.gfxile.net/g3/# I also completed Datacamp a year ago (although I wouldn't recommend them now due to the claims of toxic leadership). There are...

    I have used this resource in the past:

    http://sol.gfxile.net/g3/#

    I also completed Datacamp a year ago (although I wouldn't recommend them now due to the claims of toxic leadership). There are also courses on Udemy that you could use.

    3 votes
    1. [5]
      Gaywallet
      Link Parent
      Can you elaborate on the toxic leadership? I have a subscription to them I pay through my work that I very occasionally use to slowly learn python and brush up on my R, but would like to know if I...

      Can you elaborate on the toxic leadership? I have a subscription to them I pay through my work that I very occasionally use to slowly learn python and brush up on my R, but would like to know if I should take my corporate training money elsewhere for good reason.

      1 vote
      1. [2]
        cmccabe
        Link Parent
        There was an alleged sexual harassment incident by the CEO that was covered up. I say "alleged" because I don't really know much about it. However, I have seen a lot of people move from datacamp...

        There was an alleged sexual harassment incident by the CEO that was covered up. I say "alleged" because I don't really know much about it. However, I have seen a lot of people move from datacamp to dataquest.io specifically because of that incident. I bought DQ licenses for people in my org and have been pretty happy with it.

        But for learning SQL alone, I don't think you need to fork out for a subscription. The best way to learn SQL is to pick a data project that you're interested in, install SQLite, and work through a SQL primer online with your data. Having a project that you enjoy will lead you to the things you need to learn.

        5 votes
        1. Gaywallet
          Link Parent
          Thanks for the info, good to know. Datacamp subscription just renewed so I will probably wait till next year to change it over.

          Thanks for the info, good to know. Datacamp subscription just renewed so I will probably wait till next year to change it over.

          1 vote
      2. [2]
        Icarus
        Link Parent
        Apparently they had some sexual harassment issues that they were trying to obfuscate: https://www.buzzfeednews.com/article/daveyalba/datacamp-sexual-harassment-metoo-tech-startup

        Apparently they had some sexual harassment issues that they were trying to obfuscate:

        https://www.buzzfeednews.com/article/daveyalba/datacamp-sexual-harassment-metoo-tech-startup

        3 votes
        1. Gaywallet
          Link Parent
          Thanks for this link, it provides a lot of distinct details. They definitely handled this poorly. I'll take my money elsewhere in the future. That being said, I was imagining it would likely be a...

          Thanks for this link, it provides a lot of distinct details. They definitely handled this poorly. I'll take my money elsewhere in the future. That being said, I was imagining it would likely be a lot worse than it was (these situations are often more than one person speaking up about being sexually harassed).

          2 votes
  6. [2]
    uselessabstraction
    (edited )
    Link
    So I'll begin by saying that I'm no expert, but I come from an on again off again hobbyist systems programming background and recently have had the privilege of working on a really cool project...

    So I'll begin by saying that I'm no expert, but I come from an on again off again hobbyist systems programming background and recently have had the privilege of working on a really cool project which is significantly dependent on a PostgreSQL back-end. I've dabbled with some simple SQL queries in the past when fooling around with software like message boards or wikis, but this has been my first experience working at a level where I'm actually designing APIs, figuring out the best way to organize and store records in the database, and dealing with a (modestly) significant set of live and growing production data.

    This has put me in daily contact with a couple top notch professionals who have experience administrating exponentially larger databases at their day jobs and the amount of knowledge I have picked up over the past four weeks has been incredible.

    To be clear, I'm still a weenie with much to learn, but what I think is important to emphasize is that a lot of the SQL tutorials out there have you operating on what is essentially dead data, meanwhile live databases are constantly changing and evolving in their workloads, bottlenecks, and functional requirements. If you can get the chance to work with live data, or speak with people who do, or even idle in an IRC/Matrix channel of an open source project dealing with database systems, it can open up a whole new world compared to the bland tutorials where you query a table of cities to see which states contain a city with a certain name.

    1 vote
    1. acdw
      Link Parent
      Thanks for this take! It's one of those things where, now that you've said it, I'm like, "duh!" But I hadn't thought of it before now. I'll probably learn the basics on dead data and then do as...

      To be clear, I'm still a weenie with much to learn, but what I think is important to emphasize is that a lot of the SQL tutorials out there have you operating on what is essentially dead data, meanwhile live databases are constantly changing and evolving in their workloads, bottlenecks, and functional requirements

      Thanks for this take! It's one of those things where, now that you've said it, I'm like, "duh!" But I hadn't thought of it before now. I'll probably learn the basics on dead data and then do as you suggest, thank you!