zoukankan      html  css  js  c++  java
  • Oracle实用操作

    查询用户下所有表:select * from tab; 

    删除表: drop table 表名; 

    但是删除表后还是会查询到BIN开头的垃圾表,drop后的表存在于回收站:

    清空回收站所有表:  purge recyclebin; 

    打开/创建文本: ed 文件名.sql 

    执行文本脚本: @ 文件名.sql 

    创建表(创主键): 

    create table company(
        cid number(11) primary key, 
        cname varchar2(20) not null
    );

    创建表(创复合主键):  

    create table company(
        cid number(11),
        cname varchar2(20) not null,
        constraint pk_company primary key(cid)
    );

    创建表(创外键):

    create table emp(
        eid number(11) primary key,
        ename varchar2(20) not nullcid number(11) references company(cid)
    );

    创建表(创复合外键):

    create table emp(
      eid number(11) not null,
      ename varchar2(20) not null,
      cid number(11), 
      constraint pk_emp primary key(eid),
      constraint fk_emp_company foreign key(cid) references company(cid)
    );

    左外连接与又外连接语法:  select * from A表 right/left outer join B表 on A.字段 = B.字段; 

    说明: 若是left则以左边的表为基准,若是right则以右边的表为基准。

    select * from emp e right outer join company c on e.CID = c.CID;
    select * from emp e left outer join company c on e.CID = c.CID;
    select * from company c left outer join emp e on e.CID = c.CID;
    select * from company c right outer join emp e on e.CID = c.CID;
  • 相关阅读:
    Rebots协议是什么?
    Requests库入门
    jieba库的使用及实例
    第六周 python组合数据类型
    python 有基础入门程序
    字符与字符串操作归纳[持续更新]
    C++调用bat并实现传值
    Python如何运行程序
    Execl数据上传到数据库
    xml 文件操作
  • 原文地址:https://www.cnblogs.com/JimKing/p/9401432.html
Copyright © 2011-2022 走看看