VARCHAR column with default value : Char Varchar : Data Types MySQL TUTORIALS


MySQL TUTORIALS » Data Types » Char Varchar »

 

VARCHAR column with default value


mysql>
mysql>
mysql> CREATE TABLE myTable
    -> (
    ->    ID SMALLINT UNSIGNED NOT NULL,
    ->    City VARCHAR(40NOT NULL DEFAULT 'Unknown'
    -> );
Query OK, rows affected (0.05 sec)

mysql>
mysql> desc myTable;
+-------+----------------------+------+-----+---------+-------+
| Field | Type                 | Null | Key | Default | Extra |
+-------+----------------------+------+-----+---------+-------+
| ID    | smallint(5unsigned | NO   |     |         |       |
| City  | varchar(40)          | NO   |     | Unknown |       |
+-------+----------------------+------+-----+---------+-------+
rows in set (0.01 sec)

mysql>
mysql> drop table myTable;
Query OK, rows affected (0.00 sec)

mysql>



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

MySQL TUTORIALS

 Navioo Data Types
» Char Varchar