After reading this post we must be able to fetch one or all record from the table conditionally. We will fetch one record based on the condition mentioned in where clause or all records when a particular value is to be retrieved. i.e., we can either select one record of our choice or all records when we choose some particular value. This is useful when we need to fetch single record or to display all records to the user. Either show selected record or all records.
HOW WE ARE GOING TO ACHIEVE THIS?
We will use most common, simple select statement and some variables along with Boolean Logic. Why Boolean Logic? Because we won't use case or if else statement.
Lets begin our excursion...