Let’s look at the database table structure in WordPress. The technical term is schema. You’ll learn about SQL data types, lengths, options, and more.
Programming languages let you specify the different types of data. Many languages let you specify different types of the same data. For example, you can specify a number as integer, short integer, long integer, floating, decimal and more. Why? Why would you want to take the time to specify a specific category of the number data type? Memory. A short integer requires less memory than a long integer. You get specific to be efficient with memory usage.
SQL is one of these languages which lets you be very specific with the data type. For a number, you can specify an INT and its length. You can specify it as a DECIMAL, BIGINT, INT, and more. String type content like custom fields, options, user meta, and post content are all specified as different data types and lengths. Why? To be efficient with memory usage.
In this episode, you are exploring the pre-defined WordPress schema for the
wp_posts database table. We’ll talk about data types, lengths, options, and more. You are learning about how SQL uses its schema to pre-define the database tables and its columns.
For the geekier folks, here is a link to the MySQL data type memory requirements.
Code. Eat. Code. Sleep. Dream about Code. Code.
Total Lab Runtime: 02:08:59
- 1 Lab Introductionfree 05:17
- 2 The Big Picturepro 14:35
- 3 Your First SQL Querypro 12:21
- 4 WordPress to Database Relationshippro 20:20
- 5 Filter Content with WHEREpro 08:24
- 6 Table Alias with ASpro 05:08
- 7 Defining Table Structure (Schema)pro 12:17
- 8 Create a New Database Tablepro 10:23
- 9 WordPress Schemapro 05:11
- 10 Exploring WordPress Queries with Query Monitorpro 07:14
- 11 SQL to Get a Custom Fieldpro 16:41
- 12 SQL to Update Custom Fieldpro 05:14
- 13 Wrap it Upfree 05:54