> For the complete documentation index, see [llms.txt](https://ret2basic.gitbook.io/ctfnote/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ret2basic.gitbook.io/ctfnote/computer-science/databases/mysql/data-types.md).

# Data Types

Common data types in MySQL:

| Data Types | Usage                        |
| ---------- | ---------------------------- |
| INT        | integers                     |
| DOUBLE     | decimals                     |
| VARCHAR    | string (less than 255 chars) |
| TEXT       | string (more than 255 chars) |
| DATETIME   | date and time                |
| DATE       | date only                    |

In MySQL, `DATETIME` and `DATE` must be quoted using single quotes or double quotes. The format must be `YYYY-MM-DD` and `HH:MM:SS`. For example, we create a new table `t_datetime`:

```sql
CREATE TABLE t_datetime (a DATE);
```

Insert a date:

```sql
INSERT INTO t_datetime (a) VALUES('2022-02-22 22:22:22');
```
