Ch 1 · Reading Data · SQL

Topic 1 of 8 in SQL — Query a Real Database — 2 lessons.

SELECT

SQL reads data from tables. SELECT chooses columns, FROM names the table. Click ▶ Run Query to run it against a real database in your browser.

WHERE

WHERE filters rows by a condition. Text goes in single quotes; numbers compare directly. Combine with AND / OR. Look at the example: it keeps only the rows where dept_id equals 1 (the Engineering department), and shows just the first_name, last_name and salary columns. WHERE is how you ask a precise question of a big table, so most real queries use one. Try changing the number to see other departments.

All topics in SQL Beginner

  1. Reading Data
  2. Sorting & Filtering
  3. Combining & Summarising
  4. SQL Basics: SELECT Queries
  5. SQL CREATE TABLE and Data Types
  6. SQL Data Import and Export
  7. SQL INSERT, UPDATE, DELETE
  8. SQL String Functions