MySQL CREATE TABLE

MySQL SELECT

Using CREATE TABLE statement in MySQL you can create a table into the database. The following example shows the statement in the simple form:

CREATE TABLE Format:

CREATE TABLE IF NOT EXISTS `tbl` (
  tbl_id int(11) NOT NULL AUTO_INCREMENT,
  tbl_title varchar(100) DEFAULT NULL,
  post_date DATE DEFAULT NULL,
  update_date DATE DEFAULT NULL,
  PRIMARY KEY (tbl_id)
) ENGINE=InnoDB
  • CREATE TABLE use for creating table
  • IF NOT EXISTS checks whether same name exists in the database
  • tbl is the table name
  • tbl_id, tbl_title, post_date etc are columns
  • AUTO_INCREMENT indicates that the value of column automatically increased whenever a new row is inserted
  • Storage engine is InnoDB

Leave a Reply

Your email address will not be published. Required fields are marked *