Primary key and Unique index
SQL> create table t1(id1 char(2),id2 char(2),id3 char(2)); Table created. SQL> desc t1
Name Null? Type
----------------------------------------- -------- ----------------------------
ID1 CHAR(2)
ID2 CHAR(2)
ID3 CHAR(2) SQL> insert into t1 values('a',null,'a'); 1 row created. SQL> commit; Commit complete. SQL> select * from t1; ID ID ID
-- -- --
a a SQL> alter table t1
add constraint PK_EMP primary key (id1,id2,id3); 2
add constraint PK_EMP primary key (id1,id2,id3)
*
ERROR at line 2:
ORA-01449: column contains NULL values; cannot alter to NOT NULL SQL> create unique index t1_idx1 on t1(id1,id2,id3); Index created. SQL> insert into t1 values('a',null,'a');
insert into t1 values('a',null,'a')
*
ERROR at line 1:
ORA-00001: unique constraint (SYS.T1_IDX1) violated
Primary key and Unique index的更多相关文章
- MySQL中KEY、PRIMARY KEY、UNIQUE KEY、INDEX 的区别
参考:MySQL中KEY.PRIMARY KEY.UNIQUE KEY.INDEX 的区别 对于题目中提出的问题,可以拆分来一步步解决.在 MySQL 中 KEY 和 INDEX 是同义.那这个问题就 ...
- mysql中key 、primary key 、unique key 与index区别
一.key与primary key区别 CREATE TABLE wh_logrecord ( logrecord_id ) NOT NULL auto_increment, ) default NU ...
- 【Mysql】key 、primary key 、unique key 与index区别
参考:https://blog.csdn.net/nanamasuda/article/details/52543177 总的来说,primary key .unique key 这些key建立的同时 ...
- 待续--mysql中key 、primary key 、unique key 与index区别
mysql中key .primary key .unique key 与index区别
- mysql中 key 、primary key 、unique key 和 index 有什么不同
mysql中 key .primary key .unique key 和 index 有什么不同 key 是数据库的物理结构,它包含两层意义和作用, 一是约束(偏重于约束和规范数据库的结构完整性), ...
- MySQL - primary key PK unique key,key PK index
primary key PK unique key 总结 primary key = unique + not null 主键不能为空每个字段值都不重复,unique可以为空,非空字段不重复 uniq ...
- Mysql中的索引()key 、primary key 、unique key 与index区别)
CREATE TABLE pre_forum_post ( pid int(10) unsigned NOT NULL COMMENT '帖子id', fid mediumint(8) unsigne ...
- primary key与unique的区别
定义了 UNIQUE 约束的字段中不能包含重复值,可以为一个或多个字段定义 UNIQUE 约束.因此,UNIQUE 即可以在字段级也可以在表级定义, 在UNIQUED 约束的字段上可以包含空值.ORA ...
- primary key和unique的区别
定义了 UNIQUE 约束的字段中不能包含重复值,可以为一个或多个字段定义 UNIQUE 约束.因此,UNIQUE 即可以在字段级也可以在表级定义, 在 UNIQUED 约束的字段上可以包含空值.OR ...
随机推荐
- WebForm开发常用代码
1.获取服务器绝对路径: public static string GetMapPath(string strPath) { if (HttpContext.Current != null) { re ...
- listActivity和ExpandableListActivity的简单用法
http://www.cnblogs.com/limingblogs/archive/2011/10/09/2204866.html 今天自己简单的总结了listActivity和Expandable ...
- 介绍一个小工具 Linqer
http://www.cnblogs.com/huangxincheng/archive/2011/05/12/2044990.html
- Gprinter Android SDK V2.1.4 使用说明
佳博打印机Android的SDK开发包,已更新到Gprinter Android SDK V2.1.4. IOS的SDK开发包更新为GprinterSDKandDemoforIOS_v1.0.8. 根 ...
- 国际化 native2ascii用法
cmd下输入: native2ascii -encoding GBK(需要编译成哪种语言) (中文文件路劲) (英文文件路劲) 其他固定 例如 native2ascii -encoding GBK C ...
- PageMapAdapter MapAdapter (续webServices)
public class PageMapAdapter extends XmlAdapter<PageMapConverter, IPage<Map<String, Object&g ...
- MySQL增删改查的常用操作指令总结
总结: 1.数据库操作: 创建库: create database db_name; 查询库: show databases; //显示所有的数据库 show create databases db_ ...
- 判断奇数,java陷阱
/** 判断是否为奇数 @author husky / public class IsOdd { public static void main(String[] args) { int demo1 ...
- 【HOJ1356】【Miller_rabin素性测试】Prime Judge
Given a positive integer, your job is writing a program to determine whether it is a prime number or ...
- visualSVN server库迁移(转)
转自:http://blog.csdn.net/yuhuijun_1/article/details/9762683 首先,VisualSVN Server Manager,包含两个路径,一个是安装路 ...