Learn
The DELETE FROM
statement deletes one or more rows from a table. You can use the statement when you want to delete existing records. The statement below deletes all records in the celebs
table with no twitter_handle
:
DELETE FROM celebs WHERE twitter_handle IS NULL;
DELETE FROM
is a clause that lets you delete rows from a table.celebs
is the name of the table we want to delete rows from.WHERE
is a clause that lets you select which rows you want to delete. Here we want to delete all of the rows where the twitter_handle columnIS NULL
.IS NULL
is a condition in SQL that returns true when the value isNULL
and false otherwise.
Instructions
1.
Delete all of the rows that have a NULL
value in the twitter handle column. In the code editor, type the following:
DELETE FROM celebs WHERE twitter_handle IS NULL; SELECT * FROM celebs;
How many rows exist in the celebs
table now?
Take this course for free
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.