zoukankan      html  css  js  c++  java
  • Oracle课程档案,第五天

    集合操作

    desc job_history:改变历史职位


    job_history:历史表

    vnion:重复值只保留一个 去除重复值 ★★

    vnion all: 把所有重复值保留 不去除重复值★★

    intersect:相交

    minus:减去

    双引号对不规范的对象命名★★

    单引号是一个字符串★★

    desc departments 查询部门表里面的有哪些列

    desc employees 查询员工表里面的有哪些列


    select employee_id, job_id from employees
    union all
    select employee_id, job_id from job_history;

    select employee_id, job_id from employees
    union
    select employee_id, job_id from job_history;

    select employee_id, job_id from employees
    intersect
    select employee_id, job_id from job_history;

    select employee_id from employees
    minus
    select employee_id from job_history;

    select employee_id, job_id, salary from employees
    union all
    select employee_id, job_id, null from job_history;

    select employee_id, job_id, to_char(salary) from employees
    union all
    select employee_id, job_id, 'no salary' from job_history;

    集合排序:
    select employee_id, job_id, salary from employees
    union all
    select employee_id, job_id, null from job_history
    order by salary;

    select employee_id, job_id, null from job_history
    union all
    select employee_id, job_id, salary from employees
    order by 3;

    salary null跟上空值 个人理解


    创建表:

    create table:创建表

    insert into:插入

    update:更新

    delete:删除表里的数据

    drop:删除表

    constraint:约束条件 commit:提交 创建表完事后 一定要提交 commit;

    not null:非空

    view:视图 drop sequence course_cid; 删除增量的名字 如果重复就用这个删除 coure_cid为你创建的要删除的重复名字

    sequence:序列

    uniquenes:唯一性 start with:从....开始

    varchar2:长字符

    modify:修改,添加

    主键(primary key)约束、外键(foreign key)约束、唯一(unique)约束、检查(check)约束、默认值(default)约束实例


    约束的类型有如下几种:
    C (check constraint on a table)
    P (primary key)
    U (unique key)
    R (Referential AKA Foreign Key)
    V (with check option, on a view)
    O (with read only, on a view)

    DML

    x:第一列+数据类型

    y:第二列+字符类型——字符类型必须加单引号

    z:第三列+日期类型


    select * from + 表名+想查的东西     select * from+表名

    desc+表名 也可以查

    删除表:drop table + 表名

    user_table:当前用户下所有表的名字

    删除行(删除数据):delete from table + 哪一行

    DDL

    修改表结构

    alter table t1 xxxxxx ★★

    删除列:alter t1 drop x

    create table t1(x(列名)int(类型) constraint(约束条件) t1_x_pk(约束的名字)primarykey(主键));

  • 相关阅读:
    VS2013中使用码云gitee建立源代码管理
    win10激活出现错误0xc004f074 解决方案
    List<string> 去重复 并且出现次数最多的排前面
    jQuery.extend(),jQuery.fn.extend() 区别
    js 获取范围内的随机数
    xslt/xpath对不存在属性的判断问题
    查询各科成绩不合格与合格人数
    微信开发之实现一键拨号及短信发送功能
    Git 常用命令
    Excel 表 导入导出
  • 原文地址:https://www.cnblogs.com/awdsjk/p/7289341.html
Copyright © 2011-2022 走看看