select empno,ename,sal from scott.emp;
SELECT empno,ename,sal FROM scott.emp;
selECT empno,ename,sal frOM scott.emp;
 select empno,ename,sal from scott.emp;
select EMPNO,ENAME,SAL from SCOTT.EMP;
select emPNO,ename,sAL from scott.EmP;
 select empno,ename,job
from scott.emp
where job='SALESMAN'
order by empno;
connect scott/tiger
select table_name from user_tables;
connect scott/1qaz2wsx
select empno as "员工编号",ename as "员工名称",job as "职务" from emp;
connect hr/hr;
select street_address from locations where state_province is null;
connect scott/1qaz2wsx
select empno,ename,sal from emp where sal < 2000 or sal > 3000;
select e.empno as 员工编号, e.ename as 员工名称, d.dname as 部门
from emp e,dept d
where e.deptno=d.deptno
and e.job='MANAGER';
insert into emp(empno,ename,job) values(9527,'EAST','SALESMAN');
select e.empno,e.ename,e.job,d.deptno,d.dname
from emp e left join dept d
on e.deptno=d.deptno;
  select e.empno,e.ename,e.job,d.deptno,d.dname
from emp e full join dept d
on e.deptno=d.deptno;
select employee_id,lower(first_name),upper(last_name) from employees where
lower(first_name) like 'a%';
select sysdate as 默认格式日期, to_char(sysdate,'YYYY-MM-DD') as 转换后日期
from dual;
select empno,ename,job from emp
where deptno=(select deptno from dept
where dname='RESEARCH');
select empno,ename,sal
from emp f
where sal > (select avg(sal) from emp where job = f.job)
order by job;
create table jobs_temp(
job_id varchar2(10) primary key,
job_title varchar2(35) not null,
min_salary number(6),
max_salary number(6)); insert into jobs_temp
select * from jobs
where jobs.max_salary > 10000;
truncate table jobs_temp;

insert into jobs_temp values('OFFICE','办公文员',3000,5000);

savepoint sp;

insert into jobs_temp values('FINANCE','财务人员',4000,8000);

select * from jobs_temp;

rollback to savepoint sp;

commit;

select * from jobs_temp;
 select max(salary),min(salary) from employees where department_id = 30;
create table employees_copy as select * from employees;

吴裕雄--天生自然ORACLE数据库学习笔记:SQL语言基础的更多相关文章

  1. 吴裕雄--天生自然ORACLE数据库学习笔记:Oracle数据备份与恢复

    run{ allocate channel ch_1 device type disk format = 'd:\oraclebf\%u_%c.bak'; backup tablespace syst ...

  2. 吴裕雄--天生自然ORACLE数据库学习笔记:过程、函数、触发器和包

    create procedure pro_insertDept is begin ,'市场拓展部','JILIN'); --插入数据记录 commit; --提交数据 dbms_output.put_ ...

  3. 吴裕雄--天生自然ORACLE数据库学习笔记:PL/SQL编程

    set serveroutput on declare a ; b ; c number; begin c:=(a+b)/(a-b); dbms_output.put_line(c); excepti ...

  4. 吴裕雄--天生自然ORACLE数据库学习笔记:Oracle 11g的闪回技术

    alter system set db_recovery_file_dest_size=4g scope=both; connect system/1qaz2wsx as sysdba; archiv ...

  5. 吴裕雄--天生自然ORACLE数据库学习笔记:数据导出与导入

    create directory dump_dir as 'd:\dump'; grant read,write on directory dump_dir to scott; --在cmd下 exp ...

  6. 吴裕雄--天生自然ORACLE数据库学习笔记:优化SQL语句

    create or replace procedure trun_table(table_deleted in varchar2) as --创建一个存储过程,传入一个表示表名称的参数,实现清空指定的 ...

  7. 吴裕雄--天生自然ORACLE数据库学习笔记:Oracle系统调优

    --修改 alter system set large_pool_size=64m; --显示 show parameter large_pool_size; select sum(getmisses ...

  8. 吴裕雄--天生自然ORACLE数据库学习笔记:用户管理与权限分配

    create user mr identified by mrsoft default tablespace users temporary tablespace temp; create user ...

  9. 吴裕雄--天生自然ORACLE数据库学习笔记:表分区与索引分区

    create table ware_retail_part --创建一个描述商品零售的数据表 ( id integer primary key,--销售编号 retail_date date,--销售 ...

  10. 吴裕雄--天生自然ORACLE数据库学习笔记:其它数据对象

    create index emp_deptno_index on emp(deptno) pctfree tablespace users; create bitmap index emp_salar ...

随机推荐

  1. GITlab安装、使用及新项目推送到gitlab

    ==================================================================================================== ...

  2. label 阻止冒泡 防止点击label 触发2次事件

    // 必须要把 jnput的外面的label加上事件阻止冒泡,否则点击label的时候,会冒泡到input上 再次触发input的点击事件 $('.xt_order_cleft_modb_rl_dx' ...

  3. .net core 通过代码创建数据库表

    0.结构: 1.API using System; using System.Collections.Generic; using System.IO; using System.Linq; usin ...

  4. 算法进阶:0x01 位运算

    一.快速幂的模板代码 a^b%p: #include<iostream> using namespace std; int main() { int a,b,p; cin>>a ...

  5. Catalyst 6500/6000 Switches ARP or CAM Table

    译:https://www.cisco.com/c/en/us/support/docs/switches/catalyst-6500-series-switches/71079-arp-cam-ta ...

  6. 卫哲VS投行女,秋后算账是阿里的企业文化吗?

    编辑 | 于斌 出品 | 于见(mpyujian) 提到马云,大家都会想到淘宝,阿里,也都期待阿里巴巴的马云爸爸能够给我们免单,从而省去我们每天为钱烦恼的后顾之忧.虽然今天要吃的瓜是有关阿里的,但是并 ...

  7. 《MySQL命令执行过程和存储引擎概述》阅读笔记

    使用MySQL的完整过程: 启动MySQL服务器程序. 启动MySQL客户端程序并连接到服务器程序. 在客户端程序中输入一些命令语句发送到服务器程序,服务器程序收到这些请求后,会根据请求的内容来操作具 ...

  8. VS2017中使用C++语言编写delay函数实现延迟

    秒级别的延时 //定义函数 void delay(int sec){ time_t start_time, cur_time; // 变量声明 time(&start_time); do { ...

  9. devexpress layoutview

    1.设定数据源 2.设置view 3.设置 templat cardview 4 显示

  10. ASP.NET Core搭建多层网站架构【8.1-使用ViewModel注解验证】

    2020/01/29, ASP.NET Core 3.1, VS2019 摘要:基于ASP.NET Core 3.1 WebApi搭建后端多层网站架构[8.1-使用ViewModel注解验证] 使用V ...