mysql数据库表a有个home字段,类型是varchar ,长度设为64,想要实现:如果用户在客户端网页里不填写数据库,那么默认显示“未填写”,例如填写了“上海公馆”,那么在网页就显示上海公馆,如果用户不填写,网页上就显示未填写。请问怎么设置这个字段。
这个截图是我测试的,结果还是不能实现。
mysql> create table test (
-> id int not null,
-> name varchar(64) not null default '未填写'
-> );
Query OK, 0 rows affected (0.01 sec)
mysql> insert into test (id) values (1) ;
Query OK, 1 row affected (0.01 sec)
mysql> select * from test;
+----+-----------+
| id | name |
+----+-----------+
| 1 | 未填写 |
+----+-----------+
1 row in set (0.00 sec)追问
我不懂这么命令啊,能不能告诉我视图模式下怎么设置?
追答用的是什么工具? mysql默认客户端?
温馨提示:答案为网友推荐,仅供参考