A database is a structured, systematized set of data. In general, it refers to software, which is used to store and manage data. In other words, a database is a set of tables, which cells contain data.
WordPress uses MySQL as its database for data storing. MySQL is software for database managing, so you can store, delete, edit, and get data when requested.
What is Table
Tables are like partitions of the database with a unique name. As you can see, tables are organized by rows and columns named data sets. It stores information in rows. Each one also has a field for every column in the table.
All fields allow restrictions for columns accordingly to the column data type. It should be mentioned, all names databases, tables, and columns have restrictions. For instance, the name could not be blank and may not contain spaces or be a reserved keyword such as TABLE or SYSTEM.
When creating a table you have to define each column. However, columns can be added, deleted, or modified after table creation. In fact, the table row is a data element. For example, the row of STUDENT_MASTER table holds a student record. At the same time, if a column value of any record is not entered, the value is termed “null”, which does not have the same meaning as space or zero.
Each table has a unique field or identifier that allows defining the record. Besides, these fields allow making relationships with other tables. For instance, STUDENT_MASTER table has STUDENT_ID column as the unique, which links to STUDENT_REPORT. So, you can get all the information about the academy performance of an individual student.
During installation WordPress will automatically create such tables inside your database as:
Each of these tables would have different columns where data is stored. For example, the wp_users table in WordPress has these columns:
- user_status display_name.
What is SQL Query
SQL is actually the abbreviation for Structured Query Language. That is to say, it is the special programming language used to work with databases. It means, to retrieve data from the database you need to send an instruction to the SQL server namely query. Almost any action like posting, configuring, or just blog reading on the web page WordPress initiates a MySQL query.
An example of a MySQL query looks like this:
SELECT * FROM wp_posts WHERE ID = 123;
SELECT * FROM wp_posts WHERE ID = 123;
This example retrieves a post content, but WordPress can also update, insert, and delete data from tables and even create new tables.
To create a query you should know the following:
- Where are the data from, which table and database;
- What information are you looking for, what fields;
- What are the conditions for the selection and how you want to sort the result.
How to Manage WordPress Database
Sometimes common WordPress issues can occur. Certainly, you should know how to troubleshoot them in a short amount of time. Therefore, it is important to find out how you can do certain tasks on your WordPress database.
For example, you would want to back up your WordPress database. phpMyAdmin is an open-source web application with a nice easy graphical user interface, it helps to manage a WordPress database. To learn more about database backing up follow Free Ways to Backup WordPress.
Click phpMyAdmin under the Databases section in cPanel.
On the left panel of the phpMyAdmin dashboard, you will see a list of your databases. In like manner, сhoose a database you want to manage by clicking on it.
Next, you will get a list of the database tables, the allowed actions with them, the records number, the storage engine, the collation, the tables’ sizes, and the overhead.
Then you will be able to perform the next possible actions:
- Browse – it opens a new window with the records list;
- Structure – it shows the database’s table structure in a new window;
- Search – it creates a search query for the chosen table;
- Insert – it inserts new records in your database table;
- Empty – it removes all the data and keeping the empty table;
- Drop – it deletes the whole table and all records stored in it.