INT1

INT1 is a type of integer data in SQL. It stores whole numbers, from -128 to 127, and uses one byte of storage. This makes it suitable for small amounts of data that do not require the larger ranges provided by other integer data types like INT2, INT3, INT4, and INT8.

Example

CREATE TABLE Employees (
ID INT1,
Name VARCHAR(30)
);
INSERT INTO Employees (ID, Name)
VALUES (1, 'John Doe');
SELECT * FROM Employees;

Output

+----+----------+
| ID | Name |
+----+----------+
| 1 | John Doe |
+----+----------+

Explanation

In the above example, INT1 is used as a data type to limit the column ID. The INT1 data type in MySQL represents a very small integer that can store numbers from -128 to 127.

Example

CREATE TABLE test (ID INT1);
INSERT INTO test (ID) VALUES (5);
SELECT * FROM test;

Output

ID
5

Explanation

The above code creates a table test with a column ID of the type INT1. Then it inserts a row with the ID value as 5. Finally, it selects all rows from the table, which is just the one row in this case.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.