zoukankan      html  css  js  c++  java
  • 20170802上课随笔

    deptno int constraint emp_deptno_fk references dept(deptno))级联约束

        deptno int constraint emp_deptno_fk references dept(deptno) on delete set null)或者on delete cascade//级联删除

    ALTER TABLE test_phone_tab disable constraint test_phone_pk; //禁用约束

    ALTER TABLE test_phone_tab enable constraint test_phone_pk; //启用约束

    序列:

    SQL> create sequence test_seq increment by 1 start with 1 maxvalue 1000 nocycle cache 20;

    SQL> create table t1(x int primary key, y int);

    SQL> insert into t1 values (test_seq.nextval, 11);       反复执行

    SQL> select * from t1;

     

    索引:

    主键和唯一性约束自动创建索引:

    SQL> select constraint_name, constraint_type from user_constraints where table_name='EMPLOYEES';

    SQL> select index_name, index_type from user_indexes where table_name='EMPLOYEES';

    SQL> set autot on

    SQL> select last_name from employees where employee_id=100;   走索引

    SQL> select email from employees;                                               走索引

    SQL> select last_name from employees where salary=2100;              全表扫描

    SQL> create index emp_salary_ix on employees(salary);

    SQL> select last_name from employees where salary=2100;              走索引

    SQL> set autot off

  • 相关阅读:
    linux的文件权限分析
    Bash 文件夹操作
    bash shell 文本文件操作
    Vim文字编辑
    Windows环境Vim编辑器如何执行Ruby代码
    JavaWeb-Servlet
    app遮罩层--网赚
    flex布局 居中
    实现绝对定位元素水平垂直居中的两种方法
    CSS背景图怎么自适应全屏(手机或者电脑)
  • 原文地址:https://www.cnblogs.com/guoxf/p/7277805.html
Copyright © 2011-2022 走看看