One ParasolOne Parasol

SQL Basics - Getting Started with Databases

Learn SQL fundamentals, SELECT statements, WHERE clauses, and basic database queries

SQL Basics - Getting Started with Databases

📚 Resources for This Lesson

What is SQL?

SQL (Structured Query Language) is the standard language for managing and manipulating databases. It allows you to create, read, update, and delete data efficiently.

Basic SELECT Statement

The SELECT statement is used to retrieve data from a database.

-- Retrieve all columns from a table
SELECT * FROM employees;

-- Retrieve specific columns
SELECT first_name, last_name, salary FROM employees;

-- Give columns an alias
SELECT first_name AS 'First Name', salary AS 'Annual Salary' FROM employees;

WHERE Clause

Filter data based on specific conditions.

-- Simple condition
SELECT * FROM employees WHERE salary > 50000;

-- Multiple conditions
SELECT * FROM employees WHERE salary > 50000 AND department = 'IT';

-- Using OR
SELECT * FROM employees WHERE department = 'IT' OR department = 'HR';

-- NOT operator
SELECT * FROM employees WHERE NOT department = 'Marketing';

Comparison Operators

LIKE Pattern Matching

-- Starts with 'A'
SELECT * FROM employees WHERE first_name LIKE 'A%';

-- Contains 'John'
SELECT * FROM employees WHERE first_name LIKE '%John%';

-- Ends with 'son'
SELECT * FROM employees WHERE last_name LIKE '%son';

ORDER BY Clause

Sort query results.

-- Sort ascending (default)
SELECT * FROM employees ORDER BY salary;

-- Sort descending
SELECT * FROM employees ORDER BY salary DESC;

-- Sort by multiple columns
SELECT * FROM employees ORDER BY department, salary DESC;

Key Takeaways

← Back to All Lessons
Copyright © 2026. Made with ♥ by OneParasol Illustrations from