
For an instructor lead, in-depth look at learning SQL click below.
Structured Query Language (SQL) is a specialized programming language used for managing and manipulating databases. While some programming languages are for general-purpose use, SQL focuses specifically on databases.
Basic SQL Commands
SELECT
The SELECT statement is 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 column_name FROM table_name; |
WHERE
The WHERE clause is used to filter records, and 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; |
UPDATE
The UPDATE statement is used to modify the existing records in a table.
|
1 2 3 4 5 |
UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition; |
DELETE
The DELETE statement is used to delete existing records in a table.
|
1 2 3 |
DELETE FROM table_name WHERE condition; |
Creating Tables in SQL
SQL gives us the functionality to create a table in a database, where each table is identified by a name. Tables contain records (rows) with data.
|
1 2 3 4 5 6 7 8 9 |
CREATE TABLE table_name ( column1 datatype, column2 datatype, column3 datatype, .... ); |
Conclusion
Databases are crucial for any software application and SQL helps us in managing and manipulating these databases. The journey of mastering SQL begins from getting the basics right. Practice writing these commands, play around with different queries, and see how the output changes. Happy Querying!
