CREATE TABLE table_name(
Id int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
Column1 char(40) DEFAULT NULL,
Column2 varchar(100) DEFAULT '',
Date timestamp DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(Id),
UNIQUE (Column1)
)
We have created a table which has four columns. 'Id' column has primary key constraints and it can not be null. 'Column1' has a character data type and it is set to null by default, a UNIQUE constraint is also assigned to it. 'Column2' has varchar datatype and it is set to blank if no value is provided while insertion. 'Date' column has a datatype of timestamp and if you will not provide any value to it, it will insert current timestamp by default.
0 Comments