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

  • 相关阅读:
    音频设备的接线图了解
    学习感悟
    音频系统操作文档
    通讯型高清视频会议摄像机
    网络继电器控制板
    linx命令 1
    28岁应该怎么样规划职业?
    Python的数值类型与序列类型
    Mysql数据库笔记
    内部类
  • 原文地址:https://www.cnblogs.com/guoxf/p/7277805.html
Copyright © 2011-2022 走看看