急!!!SQL数据库!!!!

来源:百度知道 编辑:UC知道 时间:2024/05/25 18:30:01
1 创建一个表,用sql语句实现增,删,查,改
2 在一的基础上,再创建一个表,实现联合查询,排序,分组等。

create table student (
name char(10) not null,
id char(20) primary key,
age smallint not null,
dept char(20) not null,
);

select * from student where age=22;
insert into student (name,id,age,dept) values("张三","123456",22,"信息工程");
delete from student where id="123456";
update student set age=21 where id="123456";

create table course (
id char(20) primary key,
name char(20) not null,
);

select id,name from student where age=22 order by id desc;
select id frome course group by id having count(*)>3;
select * frome student a,course b where a.id=b.id;

创建是create 增加是insert 删除是drop 查找是select 修改是update
联合查询UNION 排序是order by 分组是group by