Sometimes, data needs to be removed from a table. Find out how to accomplish that in this video.
- [Instructor] Removing a row of data from a table…can be accomplished with a delete keyword.…As with an update statement,…we need to tell the database…from where it should delete something.…It's a good idea to add a condition…to set the scope of deletion.…Otherwise, it will delete everything in the table.…Let's take a look at our table…and get rid of some records.…Alright, select star from people.…And scroll down to see some of these incomplete records…that we added before.…
Let's delete Martha White.…To do that, I'll write delete from people…where first name equals Martha…and last name equals White.…I'll run that…and I see that the query executed successfully.…I'll paint my select statement…and down here at the bottom,…I can see now that Martha White is gone.…
We can remove more than one record at a time too…with a condition that matches more than one record.…All of these new records have a null ID number,…so let's use that.…I'll change my delete statement to delete from people…where ID number is null.…Remember, null isn't zero or no.…
- 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.