久久精品人人爽,华人av在线,亚洲性视频网站,欧美专区一二三

mysql中的外鍵是什么

共計(jì) 1364 個(gè)字符,預(yù)計(jì)需要花費(fèi) 4 分鐘才能閱讀完成。

自動(dòng)寫(xiě)代碼機(jī)器人,免費(fèi)開(kāi)通

本篇內(nèi)容介紹了“mysql 中的外鍵是什么”的有關(guān)知識(shí),在實(shí)際案例的操作過(guò)程中,不少人都會(huì)遇到這樣的困境,接下來(lái)就讓丸趣 TV 小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!

Foreign keys definitions are subject to the following conditions:

Both tables must be InnoDB tables and they must not be TEMPORARY tables.

Corresponding columns in the foreign key and the referenced key must have similar internal data types inside InnoDB so that they can be compared without a type conversion. The size and sign of integer types must be the same. The length of string types need not be the same. For non-binary (character) string columns, the character set and collation must be the same.

In the referencing table, there must be an index where the foreign key columns are listed as the first columns in the same order. Such an index is created on the referencing table automatically if it does not exist.

In the referenced table, there must be an index where the referenced columns are listed as the first columns in the same order.

Index prefixes on foreign key columns are not supported. One consequence of this is that BLOB and TEXT columns cannot be included in a foreign key, because indexes on those columns must always include a prefix length.

If the CONSTRAINT symbol clause is given, the symbol value must be unique in the database. If the clause is not given, InnoDB creates the name automatically.

參照 mysql 中的說(shuō)明,建外鍵時(shí)一定要注意 2 個(gè)表字段之間的關(guān)系,一定要一致,mysql 中的數(shù)據(jù)類(lèi)型相對(duì)要比 oracle 的多,我遇到了 int,unsigned 的問(wèn)題。1 個(gè)表的 id 字段是 int,令 1 個(gè)表的 id 字段是 int,unsigned。結(jié)果建了很多次外鍵,都沒(méi)成功,找了半天才看到。看來(lái)還是太粗心。。

“mysql 中的外鍵是什么”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注丸趣 TV 網(wǎng)站,丸趣 TV 小編將為大家輸出更多高質(zhì)量的實(shí)用文章!

向 AI 問(wèn)一下細(xì)節(jié)

正文完
 
丸趣
版權(quán)聲明:本站原創(chuàng)文章,由 丸趣 2023-12-04發(fā)表,共計(jì)1364字。
轉(zhuǎn)載說(shuō)明:除特殊說(shuō)明外本站除技術(shù)相關(guān)以外文章皆由網(wǎng)絡(luò)搜集發(fā)布,轉(zhuǎn)載請(qǐng)注明出處。
評(píng)論(沒(méi)有評(píng)論)
主站蜘蛛池模板: 清远市| 苗栗县| 奉化市| 新巴尔虎右旗| 五寨县| 海宁市| 留坝县| 永兴县| 聂荣县| 宜城市| 甘孜县| 麦盖提县| 宁晋县| 诸城市| 新安县| 宁明县| 株洲县| 武鸣县| 温宿县| 望江县| 出国| 修武县| 宝鸡市| 临沭县| 五指山市| 开封县| 苍溪县| 习水县| 慈溪市| 刚察县| 轮台县| 利辛县| 无锡市| 东源县| 静宁县| 莲花县| 惠州市| 海林市| 莱州市| 子长县| 锦屏县|