Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save defenestrator/4f7dffb96919ebd45a98958d2b7c6289 to your computer and use it in GitHub Desktop.
create table my_test_table (
id int not null auto_increment,
my_char_1 char(10), -- A FIXED length string (can contain letters, numbers, and special characters). The size parameter specifies the column length in characters - can be from 0 to 255. Default is 1
my_varchar_1 varchar(50), -- A VARIABLE length string (can contain letters, numbers, and special characters). The size parameter specifies the maximum column length in characters - can be from 0 to 65535
my_binary_1 binary(16), -- Equal to CHAR(), but stores binary byte strings. The size parameter specifies the column length in bytes. Default is 1
my_varbinary_1 varbinary(32), -- Equal to VARCHAR(), but stores binary byte strings. The size parameter specifies the maximum column length in bytes.
my_tinyblob_1 tinyblob, -- For BLOBs (Binary Large OBjects). Max length: 255 bytes
my_tinytext_1 tinytext, -- Holds a string with a maximum length of 255 characters
my_text_1 text(1000), -- Holds a string with a maximum length of 65,535 bytes
my_blob_1 blob(1000), -- For BLOBs (Binary Large OBjects). Holds up to 65,535 bytes of data
my_mediumtext_1 mediumtext, -- Holds a string with a maximum length of 16,777,215 characters
my_mediumblob_1 mediumblob, -- For BLOBs (Binary Large OBjects). Holds up to 16,777,215 bytes of data
my_longtext_1 longtext, -- Holds a string with a maximum length of 4,294,967,295 characters
my_longblob_1 longblob, -- For BLOBs (Binary Large OBjects). Holds up to 4,294,967,295 bytes of data
my_enum_1 enum('a','b','c'), -- A string object that can have only one value, chosen from a list of possible values. You can list up to 65535 values in an ENUM list. If a value is inserted that is not in the list, a blank value will be inserted. The values are sorted in the order you enter them
my_set_1 set('a','b','c'), -- A string object that can have 0 or more values, chosen from a list of possible values. You can list up to 64 values in a SET list
my_bit_1 bit(8), -- A bit-value type. The number of bits per value is specified in size. The size parameter can hold a value from 1 to 64. The default value for size is 1.
my_tinyint_1 tinyint(8), -- A very small integer. Signed range is from -128 to 127. Unsigned range is from 0 to 255. The size parameter specifies the maximum display width (which is 255)
my_bool_1 bool, -- Zero is considered as false, nonzero values are considered as true.
my_boolean_1 boolean, -- Equal to BOOL
my_smallint_1 smallint(10), -- A small integer. Signed range is from -32768 to 32767. Unsigned range is from 0 to 65535. The size parameter specifies the maximum display width (which is 255)
my_mediumint_1 mediumint(20), -- A medium integer. Signed range is from -8388608 to 8388607. Unsigned range is from 0 to 16777215. The size parameter specifies the maximum display width (which is 255)
my_int_1 int(50), -- A medium integer. Signed range is from -2147483648 to 2147483647. Unsigned range is from 0 to 4294967295. The size parameter specifies the maximum display width (which is 255)
my_integer_1 integer(50), -- Equal to INT(size)
my_bigint_1 bigint(100), -- A large integer. Signed range is from -9223372036854775808 to 9223372036854775807. Unsigned range is from 0 to 18446744073709551615. The size parameter specifies the maximum display width (which is 255)
my_float_2 float(4), -- A floating point number. MySQL uses the p value to determine whether to use FLOAT or DOUBLE for the resulting data type. If p is from 0 to 24, the data type becomes FLOAT(). If p is from 25 to 53, the data type becomes DOUBLE()
my_double_1 double(16, 4), -- A normal-size floating point number. The total number of digits is specified in size. The number of digits after the decimal point is specified in the d parameter
my_double_precision_1 double precision(16, 4),
my_decimal_1 decimal(16, 2), -- An exact fixed-point number. The total number of digits is specified in size. The number of digits after the decimal point is specified in the d parameter. The maximum number for size is 65. The maximum number for d is 30. The default value for size is 10. The default value for d is 0.
my_dec_1 dec(16, 2), -- Equal to DECIMAL(size,d)
my_date_1 date, -- A date. Format: YYYY-MM-DD. The supported range is from '1000-01-01' to '9999-12-31'
my_datetime_1 datetime, -- A date and time combination. Format: YYYY-MM-DD hh:mm:ss. The supported range is from '1000-01-01 00:00:00' to '9999-12-31 23:59:59'. Adding DEFAULT and ON UPDATE in the column definition to get automatic initialization and updating to the current date and time
my_timestamp_1 timestamp, -- A timestamp. TIMESTAMP values are stored as the number of seconds since the Unix epoch ('1970-01-01 00:00:00' UTC). Format: YYYY-MM-DD hh:mm:ss. The supported range is from '1970-01-01 00:00:01' UTC to '2038-01-09 03:14:07' UTC. Automatic initialization and updating to the current date and time can be specified using DEFAULT CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP in the column definition
my_time_1 time, -- A time. Format: hh:mm:ss. The supported range is from '-838:59:59' to '838:59:59'
my_year_1 year, -- A year in four-digit format. Values allowed in four-digit format: 1901 to 2155, and 0000.
primary key (id)
);
@defenestrator
Copy link
Author

Pretty useful for QA stuffs sometimes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment