最近在学习mysql数据库,欢迎大家交流,以下是笔记的部分展示:
-> ALTER TABLE table3 CHANGE salary Salary FLOAT;#修改表的字段名
Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0
-> ALTER TABLE table3 ADD age INT(11);#添加表的字段
Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 1
-> ALTER TABLE table3 ADD gender FLOAT not null;
#添加表的字段,并设有完整性约束条件
Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> DROP TABLE 表 1; #删除表 1
Query OK, 0 rows affected (0.01 sec)
mysql> CREATE TABLE tb4
-> (id INT(11) PRIMARY KEY,
-> name VARCHAR(22) UNIQUE, #设置字段值唯一,即不能有重复的
-> location VARCHAR(20)
-> );
Query OK, 0 rows affected (0.03 sec)
附件列表