
For an instructor lead, in-depth look at learning SQL click below.
Welcome! If you are reading this post, it means you have decided to embark on your journey to learn SQL, one of the world’s leading languages in managing and handling data. This journey, like any other learning journey, begins with baby steps and you’ve come to the right place for those baby steps. By the end of this roadmap, you will have a clear vision and a solid path leading you to SQL mastery! Let’s start!
What is SQL?
SQL or Structured Query Language is the standard language used for dealing with Relational Databases. It allows you to manipulate and query data stored in a database, create and modify the design of the database itself, and control access to its data.
Getting Started: Basic SQL Queries
Let’s dive into a simple yet powerful SQL query. Imagine you have a database table Employees. A row represents an individual employee and let’s assume we have columns for name, position, and salary. We want to retrieve the complete table:
1 2 3 |
SELECT * FROM Employees; |
In this command, ‘SELECT’ is used to specify the data we want to get from the database, and ‘*’ is a wildcard character that stands for ‘all’. Hence, ‘SELECT *’ means select all columns. ‘FROM Employees’ specifies from which table to select the data.
Now, suppose we want to see only the names of the employees:
1 2 3 |
SELECT name FROM Employees; |
Using Conditions in SQL: The WHERE Statement
SQL provides us with the WHERE statement to filter our results. For example, if we want to find employees who earn more than $5000, we would write:
1 2 3 |
SELECT name FROM Employees WHERE salary > 5000; |
Updating Data: The UPDATE Statement
To modify existing records in a table, SQL employs the UPDATE statement. Suppose we want to increase salaries for everyone earning less than $5000 to exactly $5000, the code would be:
1 2 3 |
UPDATE Employees SET salary = 5000 WHERE salary < 5000; |
In the upcoming posts, I will be teaching more advanced concepts like table join operations, nested queries, data aggregation, stored procedures, triggers, and more. Mastering these concepts will bring you closer to becoming an SQL expert. Until then, practice the above commands and try experimenting with these on sample databases!