CREATE TABLE Hms.as_othersassess
(
ASSESSID National varchar (+) NOT NULL comment ' evaluation number + 24-bit customer id+6 bit random ',
CustomerID National varchar (Comment ' customer number '),
Allergy National varchar (+) Comment ' Allergy history ',
Injury National varchar ($) Comment ' Trauma history ',
Surgery National varchar (+) Comment ' Surgery history ',
Vaccination National varchar (comment) ' History of vaccination ',
Checkreport National varchar ($) Comment ' medical report ',
Createuserid National varchar (comment ' creator '),
Createtime National varchar (comment ' creation time '),
Primary KEY (ASSESSID)
);
CREATE TABLE ' as_othersassess ' (
' Assessid ' varchar (+) not NULL DEFAULT ' COMMENT ' evaluation number + 24-bit customer id+6 bit random ',
' CustomerID ' varchar (+) DEFAULT NULL COMMENT ' customer number ',
' Allergy ' varchar (+) DEFAULT NULL COMMENT ' Allergy History ',
' Injury ' varchar ($) DEFAULT NULL COMMENT ' traumatic history ',
' Surgery ' varchar ($) DEFAULT NULL COMMENT ' surgery history ',
' Vaccination ' varchar ($) DEFAULT NULL COMMENT ' vaccination history ',
' Checkreport ' varchar ($) DEFAULT NULL COMMENT ' medical report ',
' Createuserid ' varchar DEFAULT NULL COMMENT ' creator ',
' createtime ' varchar (+) DEFAULT NULL COMMENT ' creation time ',
PRIMARY KEY (' Assessid ')
) Engine=innodb DEFAULT Charset=utf8 comment= ' other evaluation information ';
ANSI SQL defines a nchar or national char as a method to indicate that a column of type char should use some predefined character sets. MySQL5.1 uses UTF8 as a predefined character set. For example, these column type declarations are equivalent:
I understand that it is equivalent to setting the table encoding by default to Utf-8
In the MySQL database, the comment for a field or column is added with the attribute comment.
In a script that creates a new table, you can add a comment by adding the Comment property to the field definition script.
The sample code is as follows:
CREATE TABLE Test (
ID int NOT NULL default 0 comment ' User ID '
)
National, comment in MySQL statements