there is a fundamental difference between removing rows and removing columns.
for example, on this website we have different users (lets say in a user table), then the columns could be: email, username, password and so forth.
when you registered your account on this website, a row got added to the user table. If you now wanted to remove your account, your row would get deleted
so rows are very often generated by people using the application while the columns are set up by the programmers. So modifying rows (users, posts, likes) happens a lot more often
ALTER TABLE table_name DROP COLUMN column_name; would work, but removing columns is far less common and requires care and planning. You need to make sure that the column isn’t used anywhere in your application anymore.
But the exercise only asks to update a single row, so that is then the starting point of the next exercise. Additional queries executed are not carried over to the next exercise.
In transact SQL you cannot use equal operator to compare a NULL value. Think about it in the sense of NULL is not a known value. Basically the system does not know or cannot determine a specific value for NULL. In mathematics, equals operation always requires you to know the specific value to which you are applying the operation. So = NULL will work but it returns nothing. This is because it didn’t know what to do with that operation simply, but it is a valid operation.
Where are IS NULL and IS NOT NULL are used to simply determine “do we know?” or “don’t we know?”.
To perform operations on NULL (non deterministic values) you cannot use standard mathematical operations and have to rely on the IS operator.
Hello,
When I use the following clause, the query results are exactly what they’re supposed to be - all the rows containing NULL as a twitter_handle are gone.
DELETE FROM celebs
WHERE twitter_handle IS NULL;
SELECT * FROM celebs;
But, afterwards, if I run JUST
SELECT * FROM celebs;
Than I see the original results again, without any rows deleted at all.
Question is, how do I delete rows permanently?
If that’s even possible…
UPDATE:
After moving on to the next Exercise, and using this clause, I see that the table in fact did update and deleted every row with NULL.
So that was the issue? I needed to refresh the page or something?