| 1 |
# Creating tables |
| 2 |
CREATE TABLE t_int (c1 TINYINT, |
| 3 |
c2 SMALLINT, |
| 4 |
c3 MEDIUMINT, |
| 5 |
c4 INT, |
| 6 |
c5 INTEGER, |
| 7 |
c6 SMALLINT UNSIGNED, |
| 8 |
c7 MEDIUMINT UNSIGNED, |
| 9 |
c8 INT UNSIGNED, |
| 10 |
c9 INTEGER); |
| 11 |
CREATE TABLE t_bigint (c1 BIGINT, |
| 12 |
c2 BIGINT UNSIGNED); |
| 13 |
CREATE TABLE t_real (c1 REAL UNSIGNED, |
| 14 |
c2 DOUBLE UNSIGNED, |
| 15 |
c3 FLOAT UNSIGNED, |
| 16 |
c4 DECIMAL UNSIGNED, |
| 17 |
c5 NUMERIC UNSIGNED, |
| 18 |
c6 DOUBLE, |
| 19 |
c7 FLOAT, |
| 20 |
c8 DECIMAL, |
| 21 |
c9 NUMERIC); |
| 22 |
Warnings: |
| 23 |
Warning 1681 UNSIGNED for decimal and floating point data types is deprecated and support for it will be removed in a future release. |
| 24 |
Warning 1681 UNSIGNED for decimal and floating point data types is deprecated and support for it will be removed in a future release. |
| 25 |
Warning 1681 UNSIGNED for decimal and floating point data types is deprecated and support for it will be removed in a future release. |
| 26 |
Warning 1681 UNSIGNED for decimal and floating point data types is deprecated and support for it will be removed in a future release. |
| 27 |
Warning 1681 UNSIGNED for decimal and floating point data types is deprecated and support for it will be removed in a future release. |
| 28 |
CREATE TABLE t_date (c1 DATE, |
| 29 |
c2 TIME, |
| 30 |
c3 TIMESTAMP, |
| 31 |
c4 DATETIME, |
| 32 |
c5 YEAR); |
| 33 |
CREATE TABLE t_char (c1 CHAR(32), |
| 34 |
c2 VARCHAR(128) BINARY, |
| 35 |
c3 VARCHAR(128), |
| 36 |
c4 BINARY(128), |
| 37 |
c5 VARBINARY(2048)); |
| 38 |
Warnings: |
| 39 |
Warning 1287 'BINARY as attribute of a type' is deprecated and will be removed in a future release. Please use a CHARACTER SET clause with _bin collation instead |
| 40 |
CREATE TABLE t_lob (c1 TINYBLOB, |
| 41 |
c2 BLOB, |
| 42 |
c3 MEDIUMBLOB, |
| 43 |
c4 LONGBLOB, |
| 44 |
c5 TINYTEXT, |
| 45 |
c6 TEXT, |
| 46 |
c7 MEDIUMTEXT, |
| 47 |
c8 LONGTEXT, |
| 48 |
c9 TINYTEXT BINARY, |
| 49 |
c10 TEXT BINARY, |
| 50 |
c11 MEDIUMTEXT BINARY, |
| 51 |
c12 LONGTEXT BINARY); |
| 52 |
Warnings: |
| 53 |
Warning 1287 'BINARY as attribute of a type' is deprecated and will be removed in a future release. Please use a CHARACTER SET clause with _bin collation instead |
| 54 |
Warning 1287 'BINARY as attribute of a type' is deprecated and will be removed in a future release. Please use a CHARACTER SET clause with _bin collation instead |
| 55 |
Warning 1287 'BINARY as attribute of a type' is deprecated and will be removed in a future release. Please use a CHARACTER SET clause with _bin collation instead |
| 56 |
Warning 1287 'BINARY as attribute of a type' is deprecated and will be removed in a future release. Please use a CHARACTER SET clause with _bin collation instead |
| 57 |
CREATE TABLE t_spec (c1 BIT(16), |
| 58 |
c2 ENUM('v1','v2','v3'), |
| 59 |
c3 SET('v1','v2','v3')); |
| 60 |
# Inserting values into the tables |
| 61 |
INSERT INTO t_int VALUES (91,92,93,94,95,96,97,98,99),(81,82,83,84,85,86,87,88,89); |
| 62 |
INSERT INTO t_bigint VALUES (91,92),(81,82); |
| 63 |
INSERT INTO t_real VALUES (8.51,8.52,8.53,8.54,8.55,8.56,8.57,8.58,8.59); |
| 64 |
Warnings: |
| 65 |
Note 1265 Data truncated for column 'c4' at row 1 |
| 66 |
Note 1265 Data truncated for column 'c5' at row 1 |
| 67 |
Note 1265 Data truncated for column 'c8' at row 1 |
| 68 |
Note 1265 Data truncated for column 'c9' at row 1 |
| 69 |
INSERT INTO t_real VALUES (9.51,9.52,9.53,9.54,9.55,9.56,9.57,9.58,9.59); |
| 70 |
Warnings: |
| 71 |
Note 1265 Data truncated for column 'c4' at row 1 |
| 72 |
Note 1265 Data truncated for column 'c5' at row 1 |
| 73 |
Note 1265 Data truncated for column 'c8' at row 1 |
| 74 |
Note 1265 Data truncated for column 'c9' at row 1 |
| 75 |
INSERT INTO t_date VALUES ('2015-07-06','20:15','2015-12-31 14:59:48','2014-11-30 13:58:47','2015'); |
| 76 |
INSERT INTO t_date VALUES ('2015-07-07','20:17','2013-12-31 17:59:47','2012-10-31 15:57:47','2010'); |
| 77 |
INSERT INTO t_char VALUES ('char-text','varchar-binary-text\nnext line','varchar-text','binary-text\nnext line','varbinary-text\nline 1\nline 2'); |
| 78 |
INSERT INTO t_char VALUES ('2char-text','2varchar-binary-text\nnext line','2varchar-text','2binary-text\nnext line','2varbinary-text\nline 1\nline 2'); |
| 79 |
INSERT INTO t_lob VALUES ('tinyblob-text readable','blob-text readable','mediumblob-text readable', |
| 80 |
'longblob-text readable','tinytext','text','mediumtext','longtext', |
| 81 |
'tinytext-binary\nnext line','text-binary\nnext line', |
| 82 |
'mediumtext-binary\nnext line','longtext-binary \nnext line'); |
| 83 |
INSERT INTO t_lob VALUES ('2tinyblob-text readable','2blob-text readable','2mediumblob-text readable', |
| 84 |
'2longblob-text readable','2tinytext','2text','2mediumtext','2longtext', |
| 85 |
'2tinytext-binary\nnext line','2text-binary\nnext line', |
| 86 |
'2mediumtext-binary\nnext line','2longtext-binary \nnext line'); |
| 87 |
INSERT INTO t_spec VALUES ( b'111', 'v1', 'v1'); |
| 88 |
SELECT * FROM t_int ; |
| 89 |
c1 c2 c3 c4 c5 c6 c7 c8 c9 |
| 90 |
91 92 93 94 95 96 97 98 99 |
| 91 |
81 82 83 84 85 86 87 88 89 |
| 92 |
SELECT * FROM t_bigint ; |
| 93 |
c1 c2 |
| 94 |
91 92 |
| 95 |
81 82 |
| 96 |
SELECT * FROM t_real; |
| 97 |
c1 c2 c3 c4 c5 c6 c7 c8 c9 |
| 98 |
8.51 8.52 8.53 9 9 8.56 8.57 9 9 |
| 99 |
9.51 9.52 9.53 10 10 9.56 9.57 10 10 |
| 100 |
SELECT * FROM t_date; |
| 101 |
c1 c2 c3 c4 c5 |
| 102 |
2015-07-06 20:15:00 2015-12-31 14:59:48 2014-11-30 13:58:47 2015 |
| 103 |
2015-07-07 20:17:00 2013-12-31 17:59:47 2012-10-31 15:57:47 2010 |
| 104 |
SELECT c3 FROM t_char; |
| 105 |
c3 |
| 106 |
varchar-text |
| 107 |
2varchar-text |
| 108 |
SELECT c5,c6,c7,c8 FROM t_lob ; |
| 109 |
c5 c6 c7 c8 |
| 110 |
tinytext text mediumtext longtext |
| 111 |
2tinytext 2text 2mediumtext 2longtext |
| 112 |
SELECT * FROM t_spec; |
| 113 |
c1 c2 c3 |
| 114 |
|