Answer the question
In order to leave comments, you need to log in
How to properly join SQL tables?
there is a NAME table
there is a PRIC table
Help me write a query that displays the following information from the NAME and PRIC tables:
Employee name; The address; Salary
But if the salary for one of the employees is not specified, then in the resulting selection in the Salary field, you must specify 0.
Answer the question
In order to leave comments, you need to log in
SELECT
n.`Name`,
n.`Address`,
CASE
WHEN p.`Zarp` IS NULL THEN 0
ELSE p.`Zarp`
END as `Zarp`
FROM `NAME` n
LEFT JOIN `PRIC` p ON n.`Name` = p.`Name`
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question