zoukankan      html  css  js  c++  java
  • sql

    看过请留个言,转载请注明出处,尊重作者劳动成果,谢谢!

    SQL主要分为三类:

    DCL:grant revoke commit rollback

    DDL:create alter drop

    DML:insert delete update (select )

     

    SQL语言基础-alter

    alter table tableName add columnName varchar2(30);

    alter table tableName drop column columnName;

    alter table tableName modify columnName varchar2(30);

    alter table tableName rename column columnName to newColumnName;

     

    SQL语言基础-select

             条件查询

    比较运算符:>,>=,<,<=,=,!=

    between a and b,in(a,b,c),not exists,is null,like ‘%_’,or,and, any,all

     

             模糊查询

    select * from scott.dept where dname like ‘_A%’

    select * from scott.dept where dname like ‘%S%’

     

             集合函数

             sum,count,max,min,avg

             select count(empno) as 员工人数 from scott.emp;

     

             分组语句

    group by 字段名 having 组过滤条件

    select deptno,count(empno) from scott.emp group by deptno having deptno>=20

     

             子查询

    select * from scott.dept d where not exists (select * from scott.emp e where e.deptno=d.deptno)

     

             表的连接

    select e.ename,d.* from scott.emp e,scott.dept d where e.deptno=d.deptno

    select e.ename,d.* from scott.emp e left outer join scott.dept d on e.deptno=d.deptno

    select e.ename,d.* from scott.emp e  join scott.dept d on e.deptno=d.deptno(+)

     

     

  • 相关阅读:
    Cookie和Session知识扫盲
    Nmap扫描原理与用法
    物理cpu与逻辑cpu的理解
    shell常用命令ping
    shell如何获取本地ip
    数据库52条SQL语句性能优化
    Linux Shell查看物理CPU个数、核数、逻辑CPU个数
    cf1225D Power Products cf1471D. Strange Definition
    cf 1389 E. Calendar Ambiguity
    cf 1420 D. Rescue Nibel!
  • 原文地址:https://www.cnblogs.com/CharmingDang/p/9663865.html
Copyright © 2011-2022 走看看