COURSE · 5 chapters · 52 lessons

SQL

Get data in and out of a database

Read about this chapter

Select, filter, sort

  1. 01A look inside a databaseA database is a pile of tables. Use SELECT * to see a whole table at once.5 slides · 13 exercisesGo to the exercises
  2. 02Just the column you wantWrite a column name after SELECT and take out the one column you need.6 slides · 13 exercisesGo to the exercises
  3. 03Line the columns upSeparate column names with commas and take out just the columns you need.6 slides · 13 exercisesGo to the exercises
  4. 04Only the rows that matchWrite a WHERE and take out only the records that match your condition.5 slides · 13 exercisesGo to the exercises
  5. 05Conditions on textText in a condition goes in single quotes. Learn when to quote and when not to.4 slides · 13 exercisesGo to the exercises
  6. 06Bigger and smallerUse > < >= <= and <> to narrow rows by something other than "equals".4 slides · 13 exercisesGo to the exercises
  7. 07Search by a word insideUse LIKE and % to find the records that contain a word.4 slides · 13 exercisesGo to the exercises
  8. 08Search by how it starts or endsMove the % to match the start or the end, and use NOT LIKE for what does not match.6 slides · 13 exercisesGo to the exercises
  9. 09Turn a condition inside outPut NOT in front of a condition and take only the rows that do not match.5 slides · 13 exercisesGo to the exercises
  10. 10Looking for what is emptyNULL never turns up in a comparison. Use IS NULL and IS NOT NULL to ask whether a value is there.5 slides · 13 exercisesGo to the exercises
  11. 11Putting conditions togetherAND means "and also", OR means "or else". Narrow down with two or more conditions.5 slides · 13 exercisesGo to the exercises
  12. 12Put it in the order you wantUse ORDER BY to sort the result. Add DESC and it goes from biggest down.5 slides · 13 exercisesGo to the exercises
  13. 13Just the first fewUse LIMIT to decide how many rows come back. With ORDER BY, that gives you a top few.4 slides · 13 exercisesGo to the exercises
  14. 14Pull out and filter: round-upThe chapter round-up. No basics this time — ten practice questions that mix everything so far.3 slides · 10 exercisesGo to the exercises
  15. 15Your first SQLUse a SELECT statement to pull some data out of a database.5 slides · 8 exercisesGo to the exercises
  16. 16Narrowing down with WHEREGet hold of WHERE and pull out only the records that match a condition.4 slides · 8 exercisesGo to the exercises