Category: "WordPress Tips"
You can access the database via WordPress. You can use any raw SQL too. That is quite easy. You only need to call a global object;
For the raw SQL, you can use query method:
SET post_parent = 10
WHERE ID = 15
For get the record set,
$drafts = $wpdb->get_results(
WHERE post_status = 'draft'
AND post_author =1
There are insert, update and delete method too.
Please read WordPress development documentation for the further information