Is it possible to use if/else in SQL? If I have a table called supplier with columns: sid -> primary key, sname and city.
Then I wish to:
select sid from supplier where city="taipei"if not empty.- Or
select sid from supplier where city="tainan"
Yes, you can. I don’t know about other DBMS but I have used such things in Microsot SQL Server in my Stored Procedure like this;
In MySQL From this link, it turns out that is also possible. see;