There are many ways when WordPress can interact with databases like using functions like get_posts(), wp_get_post_terms(), wp_query(), and $wpdb(). From all these functions the most effective function to get a database table out of WordPress is the $wpdb() function. $wpdb is a global function and hence is declared with global keyword.

global $wpdb;

BY Best Interview Question ON 22 Jun 2022