Get the names of all employees in the 'Engineering' department.
SELECT column1, column2 -- Which columns do you want? FROM table_name -- Which table are they in? WHERE condition -- How do you want to filter them? ORDER BY column1 DESC; -- How should the results be sorted? Use code with caution. Copied to clipboard 3. Practice Exercises To practice, imagine a table named : Department Engineering Engineering Exercise 1: The Basics
SELECT * means "Select everything." Use it sparingly in large databases!
SELECT * FROM Employees WHERE Salary > 75000 ORDER BY Salary DESC; Exercise 3: Aggregates Goal: Find the average salary of all employees. Your Code: SELECT AVG(Salary) FROM Employees; 4. Quick Tips for Success
SELECT Name FROM Employees WHERE Department = 'Engineering'; Exercise 2: Sorting and Filtering
SQL Essentials: Learn Fast & Practice SQL (Structured Query Language) is the standard language for talking to databases. Think of a database like a giant, organized collection of Excel spreadsheets. 1. The Core Commands (CRUD) Most SQL work revolves around four main actions: INSERT INTO Add new rows of data. Read SELECT Retrieve data. Update UPDATE Change existing data. Delete DELETE Remove data. 2. The Anatomy of a Query A standard "Read" query follows this order:
Always end your statements with a ; to tell the database you're done.
Get the names of all employees in the 'Engineering' department.
SELECT column1, column2 -- Which columns do you want? FROM table_name -- Which table are they in? WHERE condition -- How do you want to filter them? ORDER BY column1 DESC; -- How should the results be sorted? Use code with caution. Copied to clipboard 3. Practice Exercises To practice, imagine a table named : Department Engineering Engineering Exercise 1: The Basics
SELECT * means "Select everything." Use it sparingly in large databases!
SELECT * FROM Employees WHERE Salary > 75000 ORDER BY Salary DESC; Exercise 3: Aggregates Goal: Find the average salary of all employees. Your Code: SELECT AVG(Salary) FROM Employees; 4. Quick Tips for Success
SELECT Name FROM Employees WHERE Department = 'Engineering'; Exercise 2: Sorting and Filtering
SQL Essentials: Learn Fast & Practice SQL (Structured Query Language) is the standard language for talking to databases. Think of a database like a giant, organized collection of Excel spreadsheets. 1. The Core Commands (CRUD) Most SQL work revolves around four main actions: INSERT INTO Add new rows of data. Read SELECT Retrieve data. Update UPDATE Change existing data. Delete DELETE Remove data. 2. The Anatomy of a Query A standard "Read" query follows this order:
Always end your statements with a ; to tell the database you're done.