Chrome Extension

Create table with constraints MySQL query

CREATE TABLE query in MySQL is used to create a new table in MySQL.
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 are a bunch of lazy programmers so we developed this chrome extension
search code from your favorite search engine
Install Now

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.

Was this helpful?
0 Comments
Open Code Manager We are hiring