Show create TABLE table name-Displays the SQL statement that created the table.
Adds a new column to an existing table.
ALTER TABLE name add column name int null--this line adds an int type to the default nullable column.
Null means: An undefined value.
How do I compare the value of a column to null?
Can be null,is not NULL or <=>
You can compare two NULL values with <=>, null<=>null the result to true instead of undefined.
CREATE TABLE ' T1 ' (
' Col1 ' char (6) Not NULL DEFAULT ' ',
' col3 ' varchar (6) DEFAULT NULL,
`
Createtime ' timestamp not NULL DEFAULT current_timestamp on UPDATE current_timestamp
) Engine=innodb DEFAULT Charset=utf8
Select Concat (col1, ' @ ', createtime) from T1--connects the values of the columns col1 and createtime with @ to display them. (Value @ value)
SELECT DISTINCT col3 from T1--repeated values for the col3 of the array
Select COUNT (Distinct col3) from T1--Ji Lu column col3 The number of duplicate values.
Select *,if (col3 = ' abc ', ' 123 ', col3) from T1--If the value of column col3 equals ABC then 123来 will be used instead
Select *,ifnull (col3, ' 123 ') from T1--If the value of column col3 equals null then 123来 will be used instead
A null value comparison, a merge of two columns, and the column values are replaced by criteria.