
How to use IF condition in SQL SELECT statement?
In SQL Server, we have below two options to implement IF condition in SQL SELECT statement. CASE WHEN… THEN IIF Let us consider the following ‘student’ table. CREATE TABLE student ( student_name VARCHAR(50), grade CHAR(1) ) INSERT INTO student SELECT ‘Jack’, ‘A’ UNION ALL SELECT ‘Rose’, ‘B’ UNION ALL SELECT ‘John’, ‘C’ UNION ALL SELECT […]
- SQL FAQs
- February 1, 2019