FOR ORACLE: seelct * from student where stuid=NVL('123456',stuid) and school_year=NVL('2017',school_year) MYSQL seelct * from student where stuid LIKE '123456%' and school_year LIKE '2017%' Hope got your answer For more query ask me at Skype arif.3hosain