Database schema of WordPress
When we install the wordpress the wordpress contains 11 database tables by default. The major thing which wordpress prides itself because the it is very lightweight and the database is the foundation for this. When design and developing in wordpress the database structure is designed to be very minimal yet allow for endless flexibility. For understand and learn the wordpress database schema, it helps to view a database Diagram below figure shows an overview the structure of database and the tables that created during a standard installation of WordPress.
Remember that themes and plugins have the ability to create custom tables in WordPress. Additional tables also creates in WordPress Multisite it may contain many tables than by default WordPress tables.
After the every new version of WordPress when launched, then a few changes is usually done in database. Usually these changes are very minor, like change the table fields increase the fields or remove. The main and major focus of wordpress is Backward compatibility so the database is very perfectly design and it is highly managed before changing in they compare that it will not affect active themes and plugins which are already running. After a new version of WordPress is released then the codex features a very thorough database changelog by the below link: http://codex.wordpress.org/Database_Description#Changelog.
In WordPress the table structure is very consistent and stable. A unique ID field consists in every table in WordPress, and this is the primary key of the table. Every table also contains one or more indexes on fields, so this improves the speed of data retrieval and fetching when executing and run the queries against the data.
In every table the most important field is the unique ID field and this is in every table. In the table this field not always be the named of ID, this is an auto-incrementing field used to give each and every record in the table a unique identifier. Let’s suppose, after the first installation of WordPress CMS, there will be a post is created whit the titled of “Hello world!” this post is by Default created.
This post has the ID 1 because this is the first post created in the wp_posts table. In WordPress every post has a unique ID so it can be used to load post-specific information and can also be used as the joining field against other tables in the database of WordPress.
Every record and entries is saved as a new record in the wp_posts table so they each get their own unique ID of post, so your published post IDs may not be sequential in table. Let’s suppose that your first post ID may have 1, but the second post may have an ID of 17. These all depends on how many additional entries have been created between each post of WordPress.