sql - How to make a variable in the where condition represent all values? -


code:

declare @fruit varchar(70) set @fruit='apple' select * supermarket fruittype=@fruit 

how can make if variable @fruit set 'all' cause select statement retrieve values in table?

if write query this:

select *  supermarket  fruittype=@fruit or @fruit = 'all' 

then, in case @fruit equal 'all', where clause evaluates true.