
For an instructor lead, in-depth look at learning SQL click below.
Welcome to a beginner’s guide to SQL. SQL stands for Structured Query Language and is used for managing and manipulating databases. No matter if you are a data analyst or a programmer, SQL is a must-have skill.
What is SQL?
SQL is a language designed for managing data held in a relational database management system (RDBMS). It lets you access and manipulate databases, update data, select data, insert and delete data, and create and modify tables.
SQL Syntax Basics
SQL isn’t exactly like other programming languages, but its syntax is pretty straightforward. Here are a few essential pieces of SQL syntax.
SELECT
Used to select data from a database. The data returned is stored in a result table, called the result-set.
1 2 3 4 |
SELECT column1, column2 FROM table_name; |
FROM
The FROM clause is used to mention the table that you want to select records from.
1 2 3 4 |
SELECT * FROM table_name; |
WHERE
The SQL WHERE clause is used to filter records. It is used to extract only those records that fulfill a specified condition.
1 2 3 4 5 |
SELECT column1, column2 FROM table_name WHERE condition; |
Combining SQL Syntax: A Simple Query
Now let’s put it all together and run a simple SQL query. Let’s say we want to select all the records of students who have scored more than 90.
1 2 3 4 5 |
SELECT * FROM Students WHERE Score > 90; |
This command selects all records in the ‘Students’ table where the ‘Score’ is more than 90.
Conclusion
Today we have run through some of the absolute basics of SQL. There’s plenty more to learn, but hopefully this has provided a start. With practice, you’ll be running complex queries in no time.
Remember, there is no better way to learn SQL than to apply it, so try writing a few query statements yourself. Start small, and gradually take on more complex tasks. Happy querying!