当前位置:网站首页>MySQL federated primary key_ MySQL creates a federated primary key [easy to understand]
MySQL federated primary key_ MySQL creates a federated primary key [easy to understand]
2022-07-04 15:15:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
Mysql Create a federated primary key
2008 year 01 month 11 Japan Friday Afternoon 5:21
Use primary key (fieldlist)
such as :
create table mytable (
aa int,
bb char(8),
cc date,
primary key (aa,bb )
);
aa,bb For union primary key
I don't know if it's because mysql(6.0) Version issue for , Or is this the case in all versions ,mysql Create a federated primary key , The joint primary key column name cannot be enclosed in single quotation marks , Otherwise there will be a mistake , could not be built , The error is that the column does not exist in the table . The example code is as follows :
CREATE TABLE `book_sort2` (
`sort_id2` varchar(20) NOT NULL,
`sort_id1` varchar(20) NOT NULL COMMENT ‘ A class id’,
`sort_name2` varchar(20) NOT NULL COMMENT ‘ Class II name ’,
PRIMARY KEY (sort_id2,sort_id1),
KEY `sort_id1` (`sort_id1`),
CONSTRAINT `book_sort2_fk` FOREIGN KEY (`sort_id1`) REFERENCES `book_sort1` (`sort_id1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
note oracle Create a federated primary key
note alter table tablename add constraint unionkeyname primary key (column1,column2); In the above statement : tablename …
mysql establish , Add primary key
primary key 1. The simplest : CREATE TABLE t1( id int not null, name char(20)); 2. With primary key : a:CREATE TABLE t1( id …
MySQL Create a double primary key
as follows : CREATE TABLE `loginlog` ( `id` ) unsigned zerofill NOT NULL AUTO_INCREMENT COMMENT ‘ Primary key number ’, `IP` …
mysql Modify the union primary key
Reference resources https://blog.csdn.net/BockSong/article/details/80933477 alter table TABNAME drop primary key; alt …
SQL Create a federated primary key Table
CREATE TABLE [User_Instance]( [IntanceID] [int] NOT NULL, ) NOT NULL ) ON [PRIMARY] GO SET ANSI_PADD …
oracle Delete primary key , The creation of union primary key
1, Deletion of primary key ALTER TABLE TABLENAME DROP PRIMARY_KEY Run the top SQL Can delete primary key : If it doesn't work, it works ALTER TABLE TABLENAME DROP C …
Oracle Primary key 、 Query and creation of joint primary key
– Query whether a table has a unique primary key select cu.* from user_cons_columns cu, user_constraints au where cu.constraint_name = …
Hibernate(5)—— Combined the primary key 、 One to one association mapping (xml Annotation ) and Domain-driven design
It is said that , Write your own code ,6 It's someone else's code after a month …… review ! review ! review ! The knowledge points involved are summarized as follows : One to One The mapping relationship One to one foreign key (XML/Annotation) One to one bidirectional foreign key Association (XML/A …
SQL Server Union primary key in 、 Clustered index 、 Nonclustered indexes 、mysql Joint index
We all know that when we need to 2 When the uniqueness of the record can be determined only by the above Columns , You need a federated primary key , After establishing a federated primary key , When querying data, the performance will be greatly improved , However, the performance will not be improved when any column of the federated primary key is queried separately , But I …
Random recommendation
Collection and Collections The difference between ?
Collection It's the interface (Interface), Is the upper interface of the collection class . Collections It's a class (Class), Tool class for collection operation , In the service of Collection frame . It's an algorithm class , Provides a series of static methods …
Spring+Mybatis Annotation based Integration Redis
Based on this period of time redis Encountered various problems , Think about tidying up . This article mainly introduces based on Spring+Mybatis Integrate in the form of annotations Redis. Don't talk nonsense , Get to the point . First of all to prepare Redis, What I'm doing is Windows edition , download …
js Bubble sort and binary search
Bubble sort var attr=[1,5,7,6,3,9,2,8,4]; var zj=0; // Control the number of comparison rounds for(var i=0;i
hdu 4038 2011 Chengdu online competition H greedy ***
Greedy strategy 1. Make negative numbers even , And then negative numbers don't matter 2.0 Turn into 1 3.1 Turn into 2 4.2 Turn into 3 5. If the operands are left 1, be 3+1, Otherwise, fill in one 1+1, Then back 5
sql where 1=1 and 0=1 The role of
sql where 1=1 and 0=1 The role of Excerpt from : http://www.cnblogs.com/junyuz/archive/2011/03/10/1979646.html where 1=1; …
extjs Download and rename files in
Study in Xiaobai extjs In the process of , If you need to know the upload function of multiple files , You can also check Xiaobai's first essay , Hope to help you .http://www.cnblogs.com/wangqc/p/extjsFileUpload. …
Hello One year older
Time passed like this year by year … Year by year ……… Previous birthdays , Are used to quiet cats in one place . Time goes by , It's more like a silent Memorial . Maybe from 28 The age of , I have to get used to welcoming with a funny attitude . Grew up …
REDGATE Another easy to use scripting tool ScriptsManager1.3
original text :REDGATE Another easy to use scripting tool ScriptsManager1.3 REDGATE Another easy to use scripting tool ScriptsManager1.3 Let's start with : This tool is free Download address :http://ww …
jQuery Middle pull down select、 check checkbox、 The radio radio Operation code of
//select $(“#Icon”) // object $(“#Icon”).val() // Value $(“#Icon”).val(“fa …
HTML Meta Priority of information
In general meta The information of is of different dimensions, and there will be no conflict , However, there are certain conflicts between the following two :
Publisher : Full stack programmer stack length , Reprint Please indicate the source :https://javaforall.cn/149326.html Link to the original text :https://javaforall.cn
边栏推荐
- MySQL组合索引(多列索引)使用与优化案例详解
- Hexadecimal form
- selenium 元素交互
- Width accuracy
- 每周招聘|高级DBA年薪49+,机会越多,成功越近!
- Details of FPGA underlying resources
- mysql 联合主键_Mysql 创建联合主键[通俗易懂]
- Redis 解决事务冲突之乐观锁和悲观锁
- Implementation of macro instruction of first-order RC low-pass filter in signal processing (easy touch screen)
- 智能客服赛道:网易七鱼、微洱科技打法迥异
猜你喜欢
Guitar Pro 8win10最新版吉他学习 / 打谱 / 创作
flutter 报错 No MediaQuery widget ancestor found.
31年前的Beyond演唱会,是如何超清修复的?
Helix Swarm中文包发布,Perforce进一步提升中国用户体验
这几年爆火的智能物联网(AIoT),到底前景如何?
Analysis of nearly 100 million dollars stolen and horizon cross chain bridge attacked
干货 | fMRI标准报告指南新鲜出炉啦,快来涨知识吧
How to build a technical team that will bring down the company?
lnx 高效搜索引擎、FastDeploy 推理部署工具箱、AI前沿论文 | ShowMeAI资讯日报 #07.04
Flutter reports an error no mediaquery widget ancestor found
随机推荐
LeetCode 35. 搜索插入位置 —vector遍历(O(logn)和O(n)的写法---二分查找法)
AI做题水平已超过CS博士?
在芯片高度集成的今天,绝大多数都是CMOS器件
Redis 發布和訂閱
大神详解开源 BUFF 增益攻略丨直播
中国主要城市人均存款出炉,你达标了吗?
Redis sentinel mode realizes one master, two slave and three Sentinels
智能客服赛道:网易七鱼、微洱科技打法迥异
深度学习 网络正则化
找数字
Guitar Pro 8win10 latest guitar learning / score / creation
直播预告 | PostgreSQL 内核解读系列第二讲:PostgreSQL 体系结构
对话龙智高级咨询顾问、Atlassian认证专家叶燕秀:Atlassian产品进入后Server时代,中国用户应当何去何从?
Unity脚本API—GameObject游戏对象、Object 对象
What are the concepts of union, intersection, difference and complement?
Decimal, exponential
Helix Swarm中文包发布,Perforce进一步提升中国用户体验
.Net 应用考虑x64生成
Enter the width!
The performance of major mainstream programming languages is PK, and the results are unexpected