I don't know query for this custom fetch from mysql

I don’t know query for this custom selection from mysql.

My question is similar to the thing as in PHP, we have a function isset($variable) and !empty($variable), is there anything similar in mysql? because I want to fetch a set of records, where book_id is set or not left empty.

Can you post the output of a SHOW CREATE TABLE for the tables involved?

What fields (and from which tables) are required in the result set (please post an example of a result row that you expect to be returned by MySQL)?

This is the example structure. I want to fetch from table2, where book_id exists.

SELECT id
     , book_id
     , author
  FROM table2
 WHERE book_id IS NOT NULL

Thank you Rudy Sir.