Lets try creating another table and this time we will use the auto increment attribute for the primary key of the table. It has the attribute NOT NULL which means we have to provide some value. Similar to lastmodified column this will save date time value in the format 'YYYY-MM-DD HH-MM-SS'. It has an attribute DEFAULT NULL which means if we don't give any value then NULL will be saved in this column. This column will save date time value in the format 'YYYY-MM-DD HH-MM-SS'. It has an attribute DEFAULT 0 which means if we don't give any value then 0 will be automatically saved for this column. This column can save variable length string of max length 100 characters similar to the firstname column.Īnd we have to set some value for this column as it is set as NOT NULL. This is also set as NOT NULL meaning we have to set some value for this column. This column can save variable length string of max length 100 characters. The column has NOT NULL attribute that means we have to set some value for this column. This column can save variable length string and max 20 characters. Let us now explore each column of the employee table. You can use any other format that you wish to follow for the UNIQUE KEY symbol. The symbol format used in the above example is columnName_tableName_UNIQUE. In the above SQL query to create the employee table we are using the following UNIQUE KEY constraint. Syntax for the UNIQUE KEY contraint is as follows. In the above SQL query the table employee is using InnoDB storage engine. If we run the above SQL query we will get the following output. UNIQUE KEY `employeeid_employee_UNIQUE` (`employeeid`) Lets go ahead and create the employee table.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |