• 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(+)

     

     

  • 相关阅读:
    第三章函数
    基本数据类型
    gulp压缩js
    read/load
    jQuery的类数组对象结构
    立即调用表达式
    npm
    cocos2d.js
    图片上传后压缩 Thinkphp
    判断用户是否在微信中
  • 原文地址:https://www.cnblogs.com/CharmingDang/p/9663865.html
Copyright © 2020-2023  润新知