mysql檢視表結構索引 mysql檢視表結構命令

2021-10-18 11:36:24 字數 886 閱讀 8157

mysql檢視表結構命令,如下:

desc 表名;

show columns from 表名;

describe 表名;

show create table 表名;

use information_schema

select * from columns where table_name='表名';

順便記下:

show databases;

use 資料庫名;

show tables;

原有一unique索引ak_pas_name(pac_name)在表tb_webparamcounter中,

執行以下sql修改索引

alter table tb_webparamcounter drop index ak_pas_name;

alter table tb_webparamcounter add unique ak_pas_name(pc_id,pac_name);

若發現索引的邏輯不對,還需要再加乙個字段進去,執行

alter table tb_webparamcounter drop index ak_pas_name;

alter table tb_webparamcounter add unique ak_pas_name(pc_id,pac_name,pac_value);

注意:這時的pc_id,pac_name,pac_value三個字段不是foreign key

否則必需先drop foreign key,再重做上一步才行

順便提下oracle

select * from v$database;

select * from all_users;

select * from user_tables;

mysql 檢視表結構

連線到mysql d mysql 5.6.10 winx64 bin mysql h192.168.1.1 u root proot hip u使用者名稱 p密碼 url 檢視表結構 url quote 檢視表結構資訊 本人相看,得到相同的結果 1.desc 表名 2.show columns fr...

Mysql 檢視表結構

i 簡單描述表結構,字段型別 desc tabl name 顯示表結構,字段型別,主鍵,是否為空等屬性,但不顯示外來鍵。ii 查詢表中列的注釋資訊 select from information schema.columns where table schema db 表所在資料庫 and tabl...

Mysql 檢視表的索引

檢視表的索引 show index from table name 表名 1結果列表中各字段的含義 non unique 如果索引不能包括重複詞,則為0。如果可以,則為1。key name 索引的名稱。seq in index 索引中的列序列號,從1開始。column name 列名稱。collat...