How to Work with the WordPress Database: 11+ Useful SQL Queries
One of the best things about WordPress is how easy it makes it for anyone to have a great looking and functional website without any coding knowledge. It’s perfectly possible to set up a website from scratch, getting it looking exactly how you want it to, and doing whatever you want it to, without writing a line of code.
However there are advantages to being able to do your own manual tweaks to the WordPress backend. There are several types of code used in the typical WordPress site: HTML and CSS are used to control the visual appearance of the site, PHP and JavaScript provide the functionality of the website, and SQL (in combination with PHP) is used to communicate with the database.
WordPress Database Basics
All the content of your site along with its structure and user information is stored in the database. This makes WordPress sites a type of dynamic website where the HTML is generated in real time as opposed to static websites that use pre-written HTML files.
Every time someone accesses your WordPress site, the content is fetched from the database using a series of SQL queries.
All data used by your site is stored in tables in the database. You can think of a table as a storage
Source: https://managewp.org/articles/16862/how-to-work-with-the-wordpress-database-11-useful-sql-queries
source https://williechiu40.wordpress.com/2017/12/25/how-to-work-with-the-wordpress-database-11-useful-sql-queries/