1.oracle主键修改

1.1)首先查看需要修改的表的主键名,默认的情况下,数据库会自动分配

select * from user_cons_columns where table_name='表名';  注意表名可能需要大写,否则可能查不出来。

1.2)删除主键约束

alter table 表名 drop constraint 主键名(通过上一步查找出来)

1.3)添加主键约束

alter table 表名 add constraint 主键名 primary key(字段名1,字段名2...);

主键名命名规则建议为pk_表名

2.oracle设置字段可以为空

alter table 表名 modify 字段名 null;

oracle主键修改&设置某一字段可以为null的更多相关文章

  1. oracle主键修改级联外键

    举例:修改te_rygj_menu这张表的主键menu_id时,te_rygj_usermenu中的menu_id也跟着修改.利用触发器trigger实现: create or replace tri ...

  2. oracle 主键自增 设置----杜恩德

    <div id="topicList"> <div class="forFlow"> <div class = "pos ...

  3. 字段username没有默认值查询(设计数据库一定要养成好习惯,不是主键最好设置为可以为空)

    今天创建了一个表,但是username作为外键(不是主键)没有设置为可以为空,结果提交表单时忘记写username就报错了

  4. oracle主键自增

    oracle主键自增 1建立数据表 create table Test_Increase(            userid number(10) primary key,  /*主键,自动增加*/ ...

  5. oracle 主键应用序列和触发器实现自动增长

    oracle 主键自动增长 这几天搞Oracle,想让表的主键实现自动增长,查网络实现如下: create table simon_example ( id number(4) not null pr ...

  6. oracle 主键自动增长

    oracle 主键自动增长 2009-12-11 16:07:00|  分类: 数据库资料|字号 订阅     这几天搞Oracle,想让表的主键实现自动增长,查网络实现如下: create tabl ...

  7. Oracle主键异常处理

    Hibernate: insert into test1.WarnWeather (WAREA, wdate, WDAYS, WINFO, WTYPE, WNO) values (?, ?, ?, ? ...

  8. MySql数据库在表中添加新字段,设置主键,设置外键,字段移动位置,以及修改数据库后如何进行部署和维护的总结

    1,为当前已有的表添加新的字段 alter table student add studentName varchar(20) not null; 2,为当前已有的表中的字段设置为主键自增 alter ...

  9. Mysql,SqlServer,Oracle主键自动增长的设置

    1.把主键定义为自动增长标识符类型 MySql 在mysql中,如果把表的主键设为auto_increment类型,数据库就会自动为主键赋值.例如: )); insert into customers ...

随机推荐

  1. Linux系统下面crontab选择默认编译器

    crontab修改默认编辑器 crontab默认编辑器为nano. 修改crontab默认编辑器为vi或者其他的编辑器. 法一: export EDITOR="/usr/bin/vim&qu ...

  2. python gevent mokey

    #eg: monkey的理解 import gevent import socket urls = ['www.baidu.com', 'www.gevent.org', 'www.python.or ...

  3. Python 图示集绵

    http://nbviewer.jupyter.org/github/pyecharts/pyecharts-users-cases/blob/master/notebook-users-cases/ ...

  4. java.net.NoRouteToHostException

    1.之前一直默认的一个请求url,后来后台ip更换后,就报上述错误.网上好多方法说:关闭服务器端的防火墙,但试过没用. 问题有待重新测试解决

  5. MySql union与order by

    [MySql union与order by] 如果您想使用ORDER BY或LIMIT子句来对全部UNION结果进行分类或限制,则应对单个地SELECT语句加圆括号,并把ORDER BY或LIMIT放 ...

  6. day24 面向对象三大特性之封装

    本周内容 组合 封装 多态 面向对象高级 异常处理 网络协议 通讯原理 互联网协议 TCP/UDP 基于TCP协议的套接字 上周回顾 1.xml,os,os.path 2.ATM+购物车 三层结构 3 ...

  7. 全国绿色计算大赛 模拟赛第一阶段(C++)第1关:求和

    挑战任务 这次“绿盟杯”大赛,小明作为参赛选手在练习的时候遇到一个问题,他要对一个范围的两个数进行数位的累加,例如有两个数 15,19 则 他们的数位和应该为:1+5+1+6+1+7+1+8+1+9, ...

  8. JS散度

    https://blog.csdn.net/weixinhum/article/details/85227476

  9. TOJ 4383 n % ( pow( p , 2) ) ===0

    传送门:http://acm.tzc.edu.cn/acmhome/problemdetail.do?&method=showdetail&id=4383 描述 There is a ...

  10. 200. Number of Islands (Graph)

    Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surro ...