SQL – Beginners

One of the main questions that I receive from co-workers is “how do I learn SQL?” and “What tools can I use to become better at SQL?”. Learning SQL is very useful tool for trouble-shooting, systems support, report generation, database administration and development.

These are my tips to help you start learning SQL

Not all SQL databases are equal, Oracle is different from Postgres and MSSQL Server is different from both but they all have similarity to each other. I would recommend taking note of which system you want to learn from first and using that system to build your base knowledge off of. If you do not have a specific product in mind, I would recommend Postgres as it is the easiest to download, install and start off with but has powerful options like arrays, hstores, json, and XML column options to learn from.

Download a sample database, this is an easy way to learn how the SQL creates tables, inserts data and views. postgresqltutorial.com has a good layout diagram and a starter DVD Rental database.

Learning the basics, my favorite site to direct people to for SQL basics is w3resource.com as they have information and exercises for many platforms.

Learning to join tables allows you to combine table information to build a more accurate representation of the data you need. This is important because information is split by tables in databases so everything you need to display is not on the same table. Example: In the DVD Rental database mentioned above, you have a “film” table with 13 columns but if you want to see the actors of each film you will need to join the table with the “actor” table.

As an example, in Postgres I would do something like this:

SELECT F.TITLE, F.DESCRIPTION, F.RELEASE_YEAR, ARRAY_AGG(A.FIRST_NAME ||' ' || A.LAST_NAME) FROM FILM F, ACTOR A, FILM_ACTOR FA WHERE F.FILM_ID = FA.FILM_ID AND FA.ACTOR_ID = A.ACTOR_ID;

This is an explicit join statement which allows me to join 3 tables to display only the information I want from two of the tables and adds an array for the actors names to keep everything one row even though you have multiple actors listed.

Use Udemy when they have sales going on, you can pick up a course for less than a happy meal. It could be specific to the database structure you are looking to use and they normally provide good projects.

Keep yourself engaged! For me, learning something that isn’t exactly useful isn’t fun or easy so make it interesting. I try to think of something I can use, in this case my main project for learning was creating a database of my financial bank records. This project provided database design, problem solving, logic creation and many more things that are very useful for SQL advancement. You have to learn how to create tables, import data exported from your bank in CSV format, create logic to parse this data into useful information. This design was to help me understand my financials, where our money is going and to help my family start saving for the future.

One thing I notice in the workspace, people show they want to learn but they are not willing to actually spend a few dollars on a book or a Udemy course and take the initiative. If you identify X will help me achieve a goal or career success, take the bull by the horns and figure out how to gain that knowledge without waiting a lifetime for it to be handed to you.

I hope this helps and if you have any recommendations, please let me know if the comments below.

I am not paid, sponsored by, invested in or even remotely related to the linked sites, products or companies listed in this article. These are honest recommendations of sites and/or products that I have used and documented to help everyone in our community.

Leave a Reply