SQL stands for the structured query language. MySQL Data Types is a database management system that allows you to manage relational databases. It is open source software backed by Oracle. It means you can use MySQL without paying a dime. Also, if you want, you can change its source code to suit your needs. SQL is the standardized language used to access the database. SQL contains three parts:
Data definition language includes statements that help you define the database and its objects e.g. views, triggers, etc.
Data manipulation language contains statements that allow you to update and query data.
Data control language allows you to grant permission to a user to access specific data in the database.

MySQL Data Types:

freepik mysql data types  
MySQL underpins various SQL data types broken into three categories:
  1. Numeric
  2. Date and Time Types
  3. String Types
  4. Spatial Datatypes
  5. Boolean Datatypes
  6. The JSON Data Type
Let us now discuss them thoroughly:

1- Numeric Data Types

MySQL utilizes all the standard ANSI SQL numeric data types, so in case you’re returning to MySQL from an alternate database system, these definitions can look acquainted to you. The following list shows the common numeric data types and their descriptions:
Data Types
Signed:-2147483648 to 2147483647Unsigned:0 to 4294967295
An ordinary estimated integer that can be signed or unsigned having a different range. You can determine a width of up to 11 digits.
Signed:– 128 to 127Unsigned:0 to 255
A very small integer that can be signed or unsigned. You can indicate a width of up to 4 digits.
Signed:– 32768 to 32767Unsigned:0 to 65535
A small integer that can be signed or unsigned. You can determine a width of upto 5 digits.
Signed:- 8388608 to 8388607Unsigned:0 to 16777215
A medium-sized integer that can be signed or unsigned. You can specify a width of up to 9 digits.
Signed:-9223372036854775808 to 9223372036854775807Unsigned:0 to 18446744073709551615
A substantial integer that can be signed or unsigned. You can specify a width of up to 20 digits.
-1.79E+ 308 to 1.79E + 308
A floating point number that can’t be unsigned. You can characterize the presentation length (M) and the number of decimals (D). This isn’t required and will default to 10,2, where 2 is the number of decimals and 10 is the total number of digits (including decimals). Decimal accuracy can go to 24 places for a FLOAT.
-10^38+1 to 10^38 -1
An unloaded floating point number that can’t be unsigned. In the unloaded decimals, every decimal relates to one byte. Characterizing the display length (M) and the number of decimals (D) is required. NUMERIC is an equivalent word for DECIMAL.

2- Date and Time Types

The MySQL date and time data types are as follows:
Data  Type
Stores date in this format YYYY-MM-DD
Stores the time in an HH:MM: SS organize.
A date and time blend in YYYY-MM-DD HH:MM: SS format
Stores number of seconds go since the Unix age (‘1970-01-01 00:00:00’ UTC)
Stores a year in a 2-digit or a 4-digit design.

3- String Data Types

In spite of the fact that the numeric and date types are fun, most data you’ll store will be in a string format. This list depicts the basic string data types in MySQL.
Data Type
A fixed length string somewhere in the range of 1 and 255 characters long.
A variable-length string somewhere in the range of 1 and 255 characters in length.
A field with a most extreme length of 65535 characters.
A BLOB or TEXT segment with a maximum length of 255 characters. You do not indicate a length with TINYBLOB or TINYTEXT.
A BLOB or TEXT column with a maximum length of 16777215 characters. You do not indicate a length with MEDIUMBLOB or MEDIUMTEXT.
An enumeration, which is a fancy term for the list. When defining an ENUM, you are making a list of items from which the value must be selected (or it can be NULL).

4- Spatial Data Types

MySQL bolsters many spatial data types that contain different sorts of geometrical and geological values are GEOMETRY, POINT, LINESTRING, POLYGON, GEOMETERYCOLLECTION, MULTILINESTRING, MULTIPOINT, MULTIPOLYGON.

5- BOOLEAN Data Type

The BOOLEAN data type supports the capacity of two values TRUE or FALSE. No parameters are required while declaring a BOOLEAN data type. Use the case-insensitive keywords TRUE or FALSE to assign a value to a BOOLEAN data type. Comparisons using the BOOLEAN data type should also use these keywords. If you attempt to assign any other value to a BOOLEAN data type, an error is raised.

MySQL Create Table:

To start with, the table creation command requires the Name of the Table, Name of the Fields & Definitions for each field


Here is a conventional SQL language structure to make a MySQL table:
CREATE TABLE table_name (column_name column_type);

Creating Tables from CommandPrompt

It is easy to create a MySQL table from the mysql> prompt. You will use the SQL command CREATE TABLE to create a table.

Creating Tables Using PHP Script

To create a new table in an existing database you would need to use PHP function mysql_query(). You will pass its second argument with an appropriate SQL command to create a table.

Leave a comment

Your email address will not be published. Required fields are marked *