It's helpful to narrow down a query, especially if you're only looking for information that matches a particular condition. Explore the WHERE command in this video.
- When we're asking the database for information,…it's very helpful to be able to give some parameters.…You can use the WHERE keyword to add a condition…to a SELECT statement.…For example, if I wanted to see all of the records,…only for people who live in California,…I could use my SELECT * FROM people statement…and then add a WHERE clause with the predicate…or condition state='CA' for California…in single quotes because it's a text string…and I'll end that with a semicolon.…
I see here that I have 127 rows returned…and all of these results have California as the state.…Try it out with a different state…by changing the expression.…I'll change CA to FL for Florida.…And there's 93 rows.…Or maybe Washington with WA.…(clicking)…19 rows.…(typing)…And NY for New York.…
62 rows.…Let's try with a different field.…Let's change our field in our predicate to ask instead…who in our database asked for a shirt as opposed to a hat…when they signed up for our contest.…There's a column here call shirt_or_hat…so I'll write shirt_or_hat…
- Name the predicate of the following statement: SELECT EyeColor, Age FROM Student WHERE FirstName = 'Tim' ORDER BY LastName ASC;
- Explain what to use to enforce the order in which an expression must be evaluated if the WHERE clause contains multiple expressions to evaluate.
- Identify the best option to join two tables in a database to be able to display data from both.
- List a data type that is not numeric.
- Determine the result of running the following statement on a table containing columns col_1 and col_2:
- INSERT INTO Box (col_1, col_2) VALUES ('A', 'B'), ('A', 'B'), ('A', 'B'), ('A', 'B');
- Determine the best approach of deleting Jon Ramirez (ID 3452) from a Student table.