摘要:
表结构: create table hy_product( id number(9,0) primary key, name nvarchar2(20) not null, price integer not null); 数据: insert into hy_product(id,name,pri 阅读全文
摘要:
--期盼值 找出AA,3;PDST,3;QPL-,3;TP-,2; --基本表 create table tb_product( id number(9,0) primary key, name nvarchar2(20) not null); --基本表充值 insert into tb_prod 阅读全文
摘要:
建表及充值: create table hy_emp( id number(9,0) primary key, name nvarchar2(20) not null, salary integer not null); insert into hy_emp select rownum,dbms_r 阅读全文
摘要:
With语句可以在查询中做成一个临时表/View,用意是在接下来的SQL中重用,而不需再写一遍。 With Clause方法的优点: 增加了SQL的易读性,如果构造了多个子查询,结构会更清晰。 示例: with soloemp as (select distinct salary from hy_e 阅读全文
摘要:
解法1:这是日本人MICK在其著作《SQL进阶教程》里提出的方法: select avg(distinct salary) from ( select t1.salary from tb_employee t1,tb_employee t2 group by t1.salary having sum 阅读全文