We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Finding NULL Values

You can use a WHERE clause to filter values by whether or not they're NULL.

IS NULL

SELECT name FROM users WHERE first_name IS NULL;

IS NOT NULL

SELECT name FROM users WHERE first_name IS NOT NULL;

Assignment

The way we store transactions at CashPal is interesting. The user identified by user_id is the "owner" of each transaction. Because user_id already identifies the owner, only the user on the other side needs another ID:

  • If the owner receives money, sender_id identifies the sender and recipient_id is NULL.
  • If the owner sends money, recipient_id identifies the recipient and sender_id is NULL.

From the transactions table, select all columns for transactions where the owner is receiving money.