mysql資料庫字典表

2021-09-24 11:34:15 字數 967 閱讀 1490

2019獨角獸企業重金招聘python工程師標準》

columns

表給出了表中的列資訊

查詢該錶的資訊可以用

select * from 

information_schema.columns where table_name = 'tbl_name'

也可以用

show columns from tbl_name
該錶主要的幾個欄位為:

data_type:字段型別

column_type:欄位的精確型別

column_comment:欄位的注釋

key_column_usage表描述了具有約束的鍵列

可以用

select  * from information_schema key_column_usage
查詢對應的資訊

該錶存放了主鍵和外來鍵的資訊

使用alter table tbl_name drop foreign key  constraint_name可以刪除某張表的外來鍵並從該字典表刪除相應的資訊

有時候使用drop table tbl_name時會報以下錯誤:

[sql]drop table logistics_order;

[err] 1217 - cannot delete or update a parent row: a foreign key constraint fails

表明該錶被有某個欄位被其它表的外來鍵依賴,這時可以用以下語句查詢出對應的約束名稱及表名

select table_name,constraint_name from `key_column_usage` t where t.referenced_table_name = tbl_name;
然後用上面的語句刪除掉約束,再執行drop語句即可刪除掉

mysql資料庫匯出表的資料字典

select column name,column type,is nullable,column comment from information schema.columns where table schema yck bts db and table name da menu 第乙個條件是資...

資料庫字典

檢視 mysql 資料庫文件,欄位表名要新增注釋 生成mysql資料字典 配置資料庫 server 127.0.0.1 username root password database 其他配置 title 系統資料字典 mysql conn mysql connect server username...

mysql資料庫表關係 資料庫 表關係

上節回顧 1.建表語法 注意點 2.資料型別 今日內容 1.表之間的關係 多對一,多對多,一對一 2.複製表 分表 為什麼要分表?乙個表中 要儲存個人資訊又要儲存部門資訊 會導致大量的資料冗餘 所有資料存放在同乙個表中 將導致以下幾個問題 1.浪費空間 不致命 2.結構混亂 3.修改資料時 如果有一...