插入,修改,删除数据(DML)
-- 在t_student数据库表中插入数据
insert into s_student values(1,'张三','男','18','2002-12-02','软件2班','123@123.com');
INSERT INTO s_student values(2,'李四','男','18','2002-12-02','软件2班','123@123.com');
insert into s_student values(3,'赵6','男','18','2002.12.02','软件2班','123@123.com');
insert into s_student values(4,"爱爱","女",'18','2002.12.02','软件2班','123@123.com');
insert into s_student values(5,"爱爱","女",'18',now(),'软件2班','123@123.com');
insert into s_student (son,sname,sex,age) values (6,"爱你","女",'18');
注:不区分大小写,单双引号。now()代表当前时间
-- 查看表记录:
select * from s_student;
运行结果:
修改表中数据:
update s_student set sex = "女" ; (把全部的sex修改成为女)
运行结果:
update s_student set sex = "男" where son=6 ;(where为条件,把son为6的修改为男)
运行结果:
UPDATE S_STUDENT SET ANG = "17" WHERE SNAME="赵6";(where为条件,把sname为赵6的age修改为17)
运行结果:
注:不区分大小写,单双引号。
删除操作:
delete from s_student where son=5; (where为条件,把son等于5的删除)
运行结果:
注:不区分大小写,单双引号。
这里全都是对数据进行操作,属于DML