IFNULL in MySQL Read Courses Improve Improve Improve Like Article Like Save Article Save Report issue Report Given a TABLE, in this TABLE, it prints entry of the table. If table is empty then it gives NULL. Examples: QUESTION : Given an employee table, print name from the given table which id equals to 2. Output : Geek2 QUESTION : Given same Employee table, print name from the given table which id equals to 5. Output : NULL Approach: In this case, we use here IFNULL. IFNULL print the null if the table is an empty or other condition. Query:- SELECT IFNULL( (SELECT NAME from employee where id = 2), 'NULL') as NAME; Output:- Geek2 Query:- SELECT IFNULL( (SELECT NAME from employee where id = 5), 'NULL') as NAME; Output:- NULL Unlock the Power of Placement Preparation!Feeling lost in OS, DBMS, CN, SQL, and DSA chaos? Our Complete Interview Preparation Course is the ultimate guide to conquer placements. Trusted by over 100,000+ geeks, this course is your roadmap to interview triumph.Ready to dive in? Explore our Free Demo Content and join our Complete Interview Preparation course. Last Updated : 03 Mar, 2018 Like Article Save Article Previous CEILING() Function in MySQL Next Joining three or more tables in SQL Share your thoughts in the comments Add Your Comment Please Login to comment...