SQL/MySQL/Data Type/Small Int

Материал из SQL эксперт
Перейти к: навигация, поиск

Define and use small int

/*
mysql> Drop table Test;
Query OK, 0 rows affected (0.11 sec)
mysql> CREATE TABLE Test
    -> (
    ->    TestID SMALLINT NOT NULL PRIMARY KEY,
    ->    Amount SMALLINT NOT NULL
    -> );
Query OK, 0 rows affected (0.05 sec)
mysql> INSERT INTO Test VALUES (101, 12),
    ->                         (102, 1),
    ->                         (103, 139),
    ->                         (104, -37),
    ->                         (105, 0),
    ->                         (106, -16);
Query OK, 6 rows affected (0.06 sec)
Records: 6  Duplicates: 0  Warnings: 0
*/
Drop table Test;
CREATE TABLE Test
(
   TestID SMALLINT NOT NULL PRIMARY KEY,
   Amount SMALLINT NOT NULL
);

INSERT INTO Test VALUES (101, 12), 
                        (102, 1), 
                        (103, 139), 
                        (104, -37), 
                        (105, 0), 
                        (106, -16);