⊗sqPaBsDT 4 of 13 menu

Basic data types for table fields in PhpMyAdmin

To work with the table further, you need to know what the main data types are. Let's look at them using the example of fields in our table.

Example . INT, AI and PRIMARY data types

The first field will be id. The numeric type INT is suitable for it:

Next, we check the AI (AUTO_INCREMENT) field. This is necessary to autofill the id field when inserting records into the table. Thanks to this, we will not need to specify id for each record in the table. In addition, the checked AI automatically assigns the Index type to id in the PRIMARY value. Now each id will be unique:

Example . VARCHAR data type

Now let's move on to the name field. We'll assign it the VARCHAR type, which is designed to work with strings. For this type, you must specify the string length. Let it be equal to 16 characters:

Example . DATE data type

The DATE type is provided for working with dates. All values ​​for this type will have the year-month-day format:

Example . DATETIME data type

You can also use the DATETIME type to store values ​​in the year-month-day hours:minutes:seconds format:

Example . TIMESTAMP data type

The TIMESTAMP type stores time as the number of seconds since 1970-01-01 00:00:00 UTC (the so-called Unix Epoch). It is used to track the time of events that occur in different time zones:

Example . Finishing the table creation

Now we just need to finish creating our table. To do this, click on the Save button:

After this, the structure of the newly created table will be displayed in the window:

Practical tasks

In the table, make 4 fields (columns): id, type integer, name, type varchar, 32 characters, age, type integer, birthday, type date.

enru