🚀SQL Basics Starter-Kit

Melania Mendes
4 min readApr 9, 2024

--

Fellow data spelunkers, 👋 I’m exicted to introduce you to the realm of SQL — a language where tables dance, queries sing, and databases whisper secrets to those who know how to ask? Yes you are right, ask the right questions!

Now, if you’re just dipping your toes into the vast ocean of relational databases, fear not as within this humble SQL Basic Starter Kit lies the key to unlocking the mysteries of data manipulation and retrieval.

All you NEED is, — your keyboard ⌨️ , and get ready to embark on a journey where every SELECT statement is a step closer to leanring and every JOIN is a chance to forge connections within the wilderness of your database. Whetehr you use GCP, AWS, Mode, etc — you’re a curious novice or a seasoned data wrangler looking for a refresher, let’s dive together headfirst into the structured chaos of SQL and command.

THE BASICS; 🌱

In a typical SQL query the general order is

⌕<SELECT — FROM — WHERE — GROUP BY — HAVING — ORDER BY — LIMIT>

Let’s take a look at the two most important commands.

. 🚀SELECT —The SELECT command is used to retrieve data from one or more tables. It specifies the columns to include in the result set and can also perform calculations and transformations on the data.

. 🚀FROM — This command specifies the table(s) from which to retrieve data. It’s the starting point for any SQL query, defining the data source.

For example, if you want to preview the columns in your table, the table being referenced is named “employees.” Within this table, our aim is to retrieve information such as the first name, last name, and salary of employees, either specifically identified or all columns using the wildcard symbol ‘ * ’.

. 🚀WHERE — The WHERE clause filters the rows returned by the SELECT statement. It defines conditions that the rows must meet to be included in the result set.

. 🚀GROUP BY — This command groups the rows returned by the WHERE clause into summary rows based on one or more columns. It’s often used with aggregate functions like SUM, COUNT, AVG, etc., to perform operations on groups of data.(which we will come to later)

. 🚀HAVING — Similar to the WHERE clause, the HAVING clause filters groups of rows resulting from the GROUP BY clause based on specified conditions. It’s used to filter the results of aggregate functions applied to groups.

. 🚀ORDER BY — This command sorts the rows returned by the SELECT statement based on one or more columns. It can sort in ascending (ASC) or descending (DESC) order.

. 🚀LIMIT — The LIMIT clause is used to restrict the number of rows returned by the SELECT statement. It’s typically used in conjunction with the ORDER BY clause to retrieve a subset of rows from the result set. When do you use this command? Sometimes, you just want sample the data and preview 10 or 20 entries, hence a LIMIT clause can come to your rescue.

PRO TIP 🧨: W3Schools stands out as an excellent starting point for honing your SQL skills, offering comprehensive explanations of key concepts. Moreover, a multitude of applications are available to reinforce your SQL training and enhance your proficiency.

All the best 😄👍

--

--