Creating tables
While defining columns in a table, you should mention the name of the column, datatype (integer, floating point, string, and so on), and default value (if any). MySQL supports various datatypes. Refer to the MySQL documentation for more details (https://dev.mysql.com/doc/refman/8.0/en/data-types.html). Here is an overview of all datatypes. The  JSON
datatype is a new extension, which will be discussed in Chapter 3, Using MySQL (Advanced):
- Numeric:
TINYINT
,SMALLINT
,MEDIUMINT
,INT
,BIGINT
, andÂBIT
. - Floating numbers:
DECIMAL
,FLOAT
, andÂDOUBLE
. - Strings:
CHAR
,VARCHAR
,BINARY
,VARBINARY
,BLOB
,TEXT
,ENUM
, andSET
. - Spatial datatypes are also supported. Refer to https://dev.mysql.com/doc/refman/8.0/en/spatial-extensions.html for more details.
- The
JSON
datatype - discussed in detail in the next chapter.
You can create many tables inside a database.
How to do it...
The table contains the column definition:
mysql> CREATE TABLE IF NOT EXISTS `company`.`customers` ( `id` int unsigned AUTO_INCREMENT...