数据库2
创建表:
CREATE TABLE student(
`id` INT(4) PRIMARY KEY auto_increment COMMENT '编号',
`name` VARCHAR(20) COMMENT '学生姓名',
`sex` TINYINT(1) DEFAULT 2 COMMENT '学生性别',
`phone`VARCHAR(11) NOT NULL COMMENT '电话号码',
`role` TINYINT(1) NOT NULL COMMENT '角色',
`score` INT(3) NOT NULL COMMENT '分数'
)
添加:
INSERT INTO (id,name,sex,phone,role,score) VALUES('1','zhangsan','2','13837689458','1','54')
INSERT INTO (id,name,sex,phone,role,score) VALUES('2','lisi','2','18537689458','2','90')
INSERT INTO (id,name,sex,phone,role,score) VALUES(3','wangwu','1','15937689458','3','94')
INSERT INTO (id,name,sex,phone,role,score) VALUES('4','zhaoliu','2','13037689458','3','82')
修改:
update student set phone 19959859570
where name = lisi
查询:
select *
from student
where score<60
查询:
select *
from student
where name like 'z%'
查询:
select *
from student
where role in (1,3 )
删除:
delete from student
where role = 1
删除:
truncate student