What is SQL?
SQL (Structured Query Language) is the standard language for working with relational databases.
SQL lets you:
- Query data — ask questions about your data
- Insert data — add new records
- Update data — modify existing records
- Delete data — remove records
- Create database objects — tables, views, indexes
💡 SQL is the universal language of data. Every major company uses SQL to manage, analyze, and understand their data.
A Simple SQL Query
-- Find all customers from New York
SELECT first_name, last_name, email
FROM customers
WHERE city = 'New York'
ORDER BY last_name;
Result:
| first_name | last_name | |
|---|---|---|
| Alice | Johnson | alice@email.com |
| Bob | Smith | bob@email.com |
What Can SQL Do?
| Operation | SQL Command | Description |
|---|---|---|
| Query data | SELECT | Retrieve data from one or more tables |
| Insert data | INSERT INTO | Add new rows to a table |
| Update data | UPDATE | Modify existing rows |
| Delete data | DELETE | Remove rows from a table |
| Create tables | CREATE TABLE | Define new database tables |
| Modify tables | ALTER TABLE | Change table structure |
| Remove tables | DROP TABLE | Delete entire tables |
Types of SQL Statements
| Category | Full Name | Commands |
|---|---|---|
| DDL | Data Definition Language | CREATE, ALTER, DROP, TRUNCATE |
| DML | Data Manipulation Language | SELECT, INSERT, UPDATE, DELETE |
| DCL | Data Control Language | GRANT, REVOKE |
| TCL | Transaction Control Language | COMMIT, ROLLBACK, SAVEPOINT |
Who Uses SQL?
- Data Analysts — query data for insights and reports
- Data Scientists — extract data for analysis and modeling
- Software Engineers — build data-driven applications
- Database Administrators — manage and optimize databases
- Business Analysts — generate business intelligence reports
⚠️ Different databases use slightly different SQL dialects. The fundamentals are the same, but specific functions and syntax may vary between MySQL, PostgreSQL, SQL Server, and SQLite.
✏️ Exercise: Write a SQL query to select the 'name' and 'price' columns from a table called 'products'.
See Solution
SELECT name, price FROM products;
✅ Key Takeaways
- SQL is the standard language for relational database management
- SQL can query, insert, update, delete, and define data
- SQL is used by data professionals across all industries
- SQL is declarative — you describe what you want, not how to get it
- Practice is the best way to learn SQL