
For an instructor lead, in-depth look at learning SQL click below.
If you are venturing into the field of data analytics or dealing with data management, SQL – Structured Query Language, is one tool you definitely need to master. SQL is a standard language designed specifically for managing data held in a Relational Database Management System (RDBMS). It’s highly useful for tasks that involve data manipulation and the treatment of data.
Getting Started With SQL Commands
SQL queries mainly get broken down into four basic types: “SELECT”, “INSERT”, “UPDATE”, and “DELETE”. These commands are the foundation of any data manipulation task.
The “SELECT” Statement
|
1 2 3 4 |
SELECT column1, column2 FROM table_name; |
The SELECT statement is used to select data from a database. The data returns as a result table. For example, to SELECT all records from a table called Customers, you’d use:
|
1 2 3 |
SELECT * FROM Customers; |
The “INSERT” Statement
|
1 2 3 4 |
INSERT INTO table_name (column1, column2, column3) VALUES (value1, value2, value3); |
We use the INSERT INTO statement to insert new data into a database. For instance, to add a new record to the Customers table:
|
1 2 3 4 |
INSERT INTO Customers (CustomerID, CustomerName) VALUES (1, 'John Doe'); |
The “UPDATE” Statement
|
1 2 3 4 5 |
UPDATE table_name SET column1=value1,column2=value2,... WHERE condition; |
The UPDATE statement is used to modify the existing records in a table. For example, to change John Doe’s CustomerName to Jane Doe in the Customers table:
|
1 2 3 4 5 |
UPDATE Customers SET CustomerName='Jane Doe' WHERE CustomerID=1; |
The “DELETE” Statement
|
1 2 3 |
DELETE FROM table_name WHERE condition; |
The DELETE statement is used to delete existing records in a table. For instance, to delete the record of Jane Doe from the Customers table:
|
1 2 3 |
DELETE FROM Customers WHERE CustomerID=1; |
Conclusion
Becoming proficient in SQL takes practice. Start off by experimenting with small datasets and then gradually move to larger, more complex ones. With time, using the commands discussed above will become second nature. This blog post only scratches the surface of SQL’s capabilities. As you continue to familiarize yourself with SQL’s syntaxis, you’ll discover it’s capable of doing far more.
