SQL Query using "CASE WHEN" - Password Comparison and Ordering by Product
Subject: SQL Query using "CASE WHEN" - Password Comparison and Ordering by Product
Hello!
I have a SQL question for you involving the usage of "CASE WHEN" statements. Suppose you are tasked with querying the "Product" table. Your goal is to extract all the columns and add an additional column based on the following condition: If "Password 1" equals "Password 2", label it as "Password 1"; if "Password 1" is not equal to "Password 2", label it as "NULL". Additionally, the results should be ordered by the "Product" column.
Here's a sample script utilizing "CASE WHEN" for your reference:
```sql
SELECT *,
CASE
WHEN "Password 1" = "Password 2" THEN 'Password 1'
ELSE 'NULL'
END AS Password
FROM Product
ORDER BY Product;
```
Feel free to provide your own solution to this problem. Happy querying! :)



