COURSE · 5 chapters · 52 lessons
SQL
Get data in and out of a database
Read about this chapter
Select, filter, sort
- 01A look inside a databaseA database is a pile of tables. Use SELECT * to see a whole table at once.Go to the exercises
- 02Just the column you wantWrite a column name after SELECT and take out the one column you need.Go to the exercises
- 03Line the columns upSeparate column names with commas and take out just the columns you need.Go to the exercises
- 04Only the rows that matchWrite a WHERE and take out only the records that match your condition.Go to the exercises
- 05Conditions on textText in a condition goes in single quotes. Learn when to quote and when not to.Go to the exercises
- 06Bigger and smallerUse > < >= <= and <> to narrow rows by something other than "equals".Go to the exercises
- 08Search by how it starts or endsMove the % to match the start or the end, and use NOT LIKE for what does not match.Go to the exercises
- 09Turn a condition inside outPut NOT in front of a condition and take only the rows that do not match.Go to the exercises
- 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.Go to the exercises
- 11Putting conditions togetherAND means "and also", OR means "or else". Narrow down with two or more conditions.Go to the exercises
- 12Put it in the order you wantUse ORDER BY to sort the result. Add DESC and it goes from biggest down.Go to the exercises
- 13Just the first fewUse LIMIT to decide how many rows come back. With ORDER BY, that gives you a top few.Go to the exercises
- 14Pull out and filter: round-upThe chapter round-up. No basics this time — ten practice questions that mix everything so far.Go to the exercises
- 16Narrowing down with WHEREGet hold of WHERE and pull out only the records that match a condition.Go to the exercises