mysql 新增外來鍵
mysql 新增外來鍵
drop table if exists `nation`;
create table `nation`(
`pii_nation` smallint(2) unsigned not null default '0',
`pii_natinoname` varchar(40) not null default '',
primary key (`pii_nation`)
)engine=innodb default charset=utf8;
drop table if exists `userinfo`;
create table `userinfo` (
`id` char(18) not null default '',
`name` varchar(20) not null default '',
`***` varchar(2) not null default '男',
`pii_nation` smallint(2) unsigned not null default '0',
primary key (`id`),
foreign key (`pii_nation`) references nation(`pii_nation`)
) engine=innodb default charset=utf8;
another look at mysql 5.1's sql diagnostic tools
資料庫的效能決定因素:
(1)資料庫的設計
(2)sql** 可以用以下幾種方法來解決一些效能問題:
(1)索引
(2)水平分割槽
(3)列適應的表
colum ......
最初的jbpm.hibernate.cfg.xml中,對mysql的方言配置成了org.hibernate.dialect.mysqldialect,發布流程的時候遇到下述錯誤:
cannot delete or update a parent row: a foreign key constraint fails
could not synchronize database state with session
將mysql方言修改為org.hibernate.dialect.mysqlinnodbdialect問 ......
在menzhi007的blog裡看到非常有意思的東西:
在mysql手冊裡:
mysql按照以下規則進行數值比較:
若有乙個或兩個引數為 null,除非null-safe <=> 等算符,則比 ......
在ubuntu9.10上使用sudo apt-get install mysql-server-5.0 安裝了mysql,在外面訪問不了mysql,但是在ubuntu上訪問是沒有問題的。
於是開始查詢原因:
3306埠是不是沒有開啟?
使用nestat命令檢視3306埠狀態:
~# netstat -an | grep 3306
tcp 0 ......
本文介紹了資料庫索引,及其優、缺點。針對mysql索引的特點、應用進行了詳細的描述。分析了如何避免mysql無法使用,如何使用explain分析查詢語句,如何優化mysql索引的應用。本文摘自《mysql 5權威指南》(3rd)的8.9節。(2007.07.05最後更新)
索引是一種特殊的檔案(innodb資料表上的索引是表空間的乙個� ......
mysql新增外來鍵
為已經新增好的資料表新增外來鍵 語法 alter table 表名 add constraint fk id foreign key 你的外來鍵欄位名 references 外表表名 對應的表的主鍵欄位名 例 alter table tb active add constraint fk id fo...
mysql新增外來鍵
為已經新增好的資料表新增外來鍵 語法 alter table 表名 add constraint fk id foreign key 你的外來鍵欄位名 references 外表表名 對應的表的主鍵欄位名 例 alter table tb active add constraint fk id fo...
mysql新增外來鍵
為已經新增好的資料表新增外來鍵 語法 alter table 表名 add constraint fk id foreign key 你的外來鍵欄位名 references 外表表名 對應的表的主鍵欄位名 例 alter table tb active add constraint fk id fo...