WordPress provides a built-in class called
wpdb for handling database queries. This class is located inside the
wp-includes directory. The
wpdb class will be available inside your plugins and themes as a global variable and provides access to all the tables inside the WordPress database, including custom tables. Using this class for queries adds an extra layer of security as well as optimizes the database queries.
wpdb class for CRUD operations is straightforward with its built-in methods. A complete guide for using the
wpdb class can be found at http://codex.wordpress.org/Class_Reference/wpdb.
Basically, there are no built-in methods for accessing custom tables using direct functions, so it's a must to use the
wpdb class for handling custom tables.