1:创建数据库 create datebase dbtest;
2:创建表 create table tabletest( id char(10) , name varchar2(100) not null, constraint pk_primary primary key(id,name) );
3:查询语句 1)全部查询
select * from tabletest2)跨表查询并排序
select a.*,b.* from tabletest a left join tabletest1 b on a.id = b.id where b.name = '张三' order by a.id desc,b.id asc3)查询相同及like 通配符
select distinct id,name from tabletest where id in ('1','2') or name like '%a%' or name like 'a_b_c' or name like '[!abc]';4)平均数,总数,个数等查询
select avg(id) from tabletest; select sum(name) from tabletest; select count(*) from tabletest; select first(id) from tabletest; select last(name) from tabletest; select top 2 id from tabletest; select max(id),min(name) from tabletest;4:插入语句
insert into tabletest (id,name) values('11','220');5:更新语句
update tabletest set id = '22' ,name = '11' where id = '1';