1.增(添加一个学生)
sql语句:
insert into student (id,name,sex,age) values(1,'张三','男',18);
意思是插入id为1,name为张三,sex为男,age为18的学生
也可以写为
insert into student values(1,'张三','男',18);
这种写法需要写全部的数据
第一种写法课写个别数据
insert into student (name,sex,age)values(1,'张三','男',18);
如下:
2. 删(删除学生)
delete from student where id=1;
删除id为1的学生信息
原表:
删除表:
3.改(修改学生表的数据)
update student set name='李四',age=17 where id=1;
意思是修改学生表中id为1的基本信息
- set是修改系统参数或变量用的
原表:
修改后:
4.查(查询学生信息)
select id,name,sex,age from student id=1;
或者
select * from student id=1;
意思是查询学生表中id为1的学生基本信息
- *代表学生表中的所以数据
查到的表: