当前位置:网站首页>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
边栏推荐
- Guitar Pro 8win10最新版吉他学习 / 打谱 / 创作
- When synchronized encounters this thing, there is a big hole, pay attention!
- Deep learning network regularization
- Ffmpeg Visual Studio development (IV): audio decoding
- [local differential privacy and random response code implementation] differential privacy code implementation series (13)
- Is BigDecimal safe to calculate the amount? Look at these five pits~~
- TechSmith Camtasia studio 2022.0.2 screen recording software
- 从0到1建设智能灰度数据体系:以vivo游戏中心为例
- Decimal, exponential
- 进制形式
猜你喜欢
LNX efficient search engine, fastdeploy reasoning deployment toolbox, AI frontier paper | showmeai information daily # 07.04
What is the future of the booming intelligent Internet of things (aiot) in recent years?
深度学习 神经网络的优化方法
Redis publier et s'abonner
开源人张亮的 17 年成长路线,热爱才能坚持
Weibo and Huya advance into interest communities: different paths for peers
C1 certification learning notes 3 -- Web Foundation
Introduction to modern control theory + understanding
Quick introduction to automatic control principle + understanding
Korean AI team plagiarizes shock academia! One tutor with 51 students, or plagiarism recidivist
随机推荐
js平铺数据查找叶子节点
输入宽度!
Preliminary exploration of flask: WSGI
Unity update process_ Principle of unity synergy
LeetCode 58. Length of the last word
Redis sentinel mode realizes one master, two slave and three Sentinels
Helix Swarm中文包发布,Perforce进一步提升中国用户体验
The per capita savings of major cities in China have been released. Have you reached the standard?
Ffprobe common commands
Unity脚本API—Component组件
unity update 协程_Unity 协程的原理
Numpy notes
华为云数据库DDS产品深度赋能
這幾年爆火的智能物聯網(AIoT),到底前景如何?
AI做题水平已超过CS博士?
When synchronized encounters this thing, there is a big hole, pay attention!
微博、虎牙挺进兴趣社区:同行不同路
I plan to teach myself some programming and want to work as a part-time programmer. I want to ask which programmer has a simple part-time platform list and doesn't investigate the degree of the receiv
深度学习 网络正则化
【学习笔记】拟阵