Skip to content
Advertisement

sql query if parameter is null select all

Can the following query be modified to return all records if the ? is null?

Advertisement

Answer

You can also use functions IFNULL,COALESCE,NVL,ISNULL to check null value. It depends on your RDBMS.

MySQL:

or

ORACLE:

SQL Server / SYBASE:

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement