• 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

  • 相关阅读:
    Add Two Numbers
    Remove Duplicates from Sorted List II
    Reorder List
    Divide Two Integers
    Reverse Nodes in k-Group
    链表反转
    模板类 error LNK2019: 无法解析的外部符号
    传参数应该用哪种形式——值、引用、指针?
    OpenMesh 将默认的 float 类型改为 double 类型
    fatal error LNK1169: 找到一个或多个多重定义的符号
  • 原文地址:https://www.cnblogs.com/guoxf/p/7277805.html
Copyright © 2020-2023  润新知