If x in the returned data recordis not NULL (does not contain 0), IFNULL() returns x, otherwise it returns y.
Because the id value you query does not exist in the database, no record is returned, and IFNULL() will not work either. As for giving a default value when no records are returned, it is recommended to implement it programmatically.
The role of IFNULL() in MySQL:
If x in the returned data recordis not NULL (does not contain 0), IFNULL() returns x, otherwise it returns y.
Because the id value you query does not exist in the database, no record is returned, and IFNULL() will not work either. As for giving a default value when no records are returned, it is recommended to implement it programmatically.