Don’t insert into the database directly. Use the proper functions so that the posts are properly created before being inserted into the database.
In your case the proper function is wp_insert_post()
:
wp_insert_post( array(
'post_type' => 'books',
'post_title' => 'harrypotter',
'post_status' => 'publish',
'post_author' => 1,
) );
The date field doesn’t need to be set manually if you want the current time.