I'm trying to write a Select query in Oracle SQL that will return first_name column as empty if last_name column is empty(Regarless what's in the first_name column value). For the first row "John" should be return as empty since he has no last_name I don't want to update the table, I just want a Select query that return empty first_name if last_name is empty. Thanks in advance!!!
You can use CASE
expression:
SELECT customer_id,
CASE
WHEN last_name IS NULL
THEN NULL
ELSE first_name
END AS first_name.
last_name.
age,
country
FROM table_name