Question 21

Table Name: College

Relevant Table: College(Professor (Text), Department (text), Salary (INT))

Professor Department  Salary
John Computer Science 60,000
Van der Mechanical Engineering NULL
Ackerman Physics 45,000
Suyash Mathematics NULL
Simrit Computer Science 56,500
Jessica Computer Science NULL
Jenny Personality Development 50,000

QUERY:  You have a table named College that stores professor information, including their salaries. Some salary values in the table are missing (NULL). You need to retrieve the professor's information and handle the NULL values in the "Salary" column by replacing them with a default value of 0.00. Write a SQL query that accomplishes this task.

Execute:      SELECT EmployeeID, FirstName,
                     LastName, COALESCE(Salary, 0.00) AS Salary
                     FROM College;

Answer:

Professor Department  Salary
John Computer Science 60,000
Van der Mechanical Engineering 0.00
Ackerman Physics 45,000
Suyash Mathematics 0.00
Simrit Computer Science 56,500
Jessica Computer Science 0.00
Jenny Personality Development 50,000