What does this statement meaning, could somebody elaborate me on this please
(@diplomaPercentage is null OR diploma_percentage>=@diplomaPercentage)
What does this statement meaning, could somebody elaborate me on this please
(@diplomaPercentage is null OR diploma_percentage>=@diplomaPercentage)
Will be returned all rows if diplomaPercentage is not specified (i.e. passed null), in other cases will be returned rows where diploma_percentage more or equal @diplomaPercentage. :)
@diplomaPercentage is a variable.
@diplomaPercentage is null is checking if the variable is NULL or not and
diploma_percentage>=@diplomaPercentage is checking if the column value diploma_percentage is greater than or equal to variable value
If you give it a null value for @diplomapercentage
then it will return all records, otherwise it will it return only the records with a diploma_percentage
value greater than or equal to the one you supply.
If no value for @diplomaPercentage is passed it it will return all rows, otherwise it will return all the rows where diploma_percentage is greater than @diplomaPercentage if a value has been passed in
This kind of condition is usually used to avoid "dynamic SQL", but it makes the code ugly and ironically may result in worse performance compared to just using dynamic SQL. You can read more about this at: