MySQL Tutorial/Insert Update Delete/Default

Материал из SQL эксперт
Перейти к: навигация, поиск

Insert statement with set statement and default value

mysql>
mysql> CREATE TABLE myTable(
    ->    ID TINYINT UNSIGNED NOT NULL DEFAULT 1,
    ->    Name VARCHAR(50) NOT NULL
    -> );
Query OK, 0 rows affected (0.03 sec)
mysql>
mysql>
mysql> INSERT DELAYED INTO myTable SET ID=DEFAULT, Name="C";
Query OK, 1 row affected (0.02 sec)
mysql>
mysql> select * from myTable;
+----+------+
| ID | Name |
+----+------+
|  1 | C    |
+----+------+
1 row in set (0.00 sec)
mysql>
mysql> drop table myTable;
Query OK, 0 rows affected (0.01 sec)
mysql>
mysql>