What is the purpose of the SQL COALESCE function? MCQ with Answer and Explanation

What is the purpose of the SQL COALESCE function?
A. Returns the first non-NULL value from a list
B. Converts data types
C. Computes the sum
D. Concatenates strings
Answer: Option A
Solution (By JKSSB Mock Tests)
COALESCE returns the first non-NULL value among its arguments, often used to provide a default value.

Discuss this Question (0)

No comments yet. Be the first to start the discussion!

Practice More Database Management System (DBMS) Questions

Question #1
Which of the following is a valid SQL statement to add a new column to a table?
A. ADD COLUMN TO table_name column_name datatype;
B. ALTER TABLE table_name ADD COLUMN column_name datatype;
C. ALTER TABLE table_name ADD column_name datatype;
D. Both A and C

Correct Answer: Option D


Explanation:
Both 'ADD column_name datatype' and 'ADD COLUMN column_name datatype' are valid syntax in some DBMS, but standard SQL uses 'ADD column_name datatype'. However, many DBMS support both.

This question belongs to: Computer Database Management System (DBMS)
Question #2
What does DDL stand for in SQL?
A. Data Manipulation Language
B. Dynamic Data Link
C. Data Description Language
D. Data Definition Language

Correct Answer: Option D


Explanation:
DDL (Data Definition Language) includes commands like CREATE, ALTER, DROP for defining database structures.

This question belongs to: Computer Database Management System (DBMS)
Question #3
Which SQL command is used to reverse or undo all modifications made during the current transaction that have not yet been committed?
A. UNDO
B. SAVEPOINT
C. ROLLBACK
D. REVERT

Correct Answer: Option C


Explanation:
The ROLLBACK command is a TCL statement used to undo transactions, restoring the database to its last committed or safe state.

This question belongs to: Computer Database Management System (DBMS)