It's helpful to retrieve and store data, but you also need to be able to change existing data. For this, there's the UPDATE keyword.
- [Instructor] Data in the database can be modified…using the UPDATE keyword.…Update is useful where we want to change information…that's already there, rather than adding new records…with different information.…To update information, we have to tell the database…which table we're using, what fields to update…with what values, and optionally, use a WHERE clause…to specify how to find records to update.…If you leave off a WHERE clause, the change will apply…to the whole table, so be careful with that.…Let's change the name for a recent entry…from George to Martha.…I know there's a value that we just added for George White,…but we can double check that…with SELECT * FROM people.…
And scrolling down the bottom of the result,…here's George White.…I'll write an update statement to change that.…I'll write UPDATE people, SET first_name='Martha',…WHERE first_name='George'…AND last_name='White'.…
Again, this WHERE clause is important,…because if I left it off, I'd set the first name of Martha…for every record in the table.…
- 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.