1:insert into 表名 values(); 向表里添加数据
INSERT INTO badboy VALUES(NULL,"手机哥",58);
INSERT INTO badboy VALUES(9527,"堕落哥",18);
2:指定字段添加 缺省插入
INSERT INTO badboy (id,name,age) VALUES(NULL,"吴金航",10);
INSERT INTO teachers(id,name,email,address,age) VALUES(NULL,"hd","[email protected]","庞各庄",40);
3:插入多列数据
INSERT INTO badboy (id,name,age) VALUES(NULL,"吴金航",10),(NULL,"刘博宇",17),(NULL,"杜登进",21),(NULL,"陈怀勇",18);
4: 将 badboy 表里的数据重定向到新表 goodboy
INSERT INTO goodboy(id,name,age) select stu_id,name,age FROM badboy;
5:update 表名 set 列 =值;修改表里所有列的内容
UPDATE badboy set name = "limingrui";
6:用 where 过滤指定修改那条数据
UPDATE badboy set age = 20 WHERE stu_id = 10000;
7:删除表里所有数据,保留表结构
DELETE FROM badboy;
TRUNCATE badboy;
8:用 where 过滤字段指定删除那条数据
DELETE FROM badboy where name = "limingrui";
10:创建表 COMMENT " "注释
CRETAE TABLE boy(
id int NOT NULL PRIMARY KEY AUT0_INCREMENT COMMNET "id",
name varchar(20) NOT NULL COMMNET "姓名",
age int(2) NOT NULL COMMNET "年龄"
) COMMNET "男孩子";