建表
建表语句:
CREATE TABLE student(
id int not null,
name char(12),
sex char(1)
);
预置数据
insert into student values(1, 'wh', 1);
insert into student values(2, 'wh1', 0);
insert into student values(3, 'zyx', 0);
commit;
增加字段
alter table student add shuxue int ;
更新语句
update student set shuxue = 60 where id = 1;
update student set shuxue = 80 where id = 2;
update student set shuxue = 90 where id = 3;
select sex as gender, count(*), avg(shuxue), sum(shuxue) from student group by sex;
select sex,count(*)from student group by sex;