mysql查詢資料庫表

2021-08-21 06:29:14 字數 539 閱讀 2555

使用sql語句查詢mysql指定表字段。

可以方便整理資料庫表的說明文件。

我在工作中整理了部分sql作為記錄。

可以用在以後的mysql文件匯出工具裡。

以下為具體內容:

使用sql查詢指定資料庫表名和表說明。

select table_name as tablename,table_comment as comments, 'classifyname' from information_schema.tables where table_schema='data_name'
使用sql查詢資料庫表說明。按順序查詢列名、型別長度、預設值和描述。

select column_name, column_type, column_default, column_comment from information_schema.columns where table_schema ='phonelive' and table_name = 'table_name' ;

MySQL查詢資料庫表和資料庫字段

information schema資訊資料庫 mysql中存在乙個自帶的資料庫information schema,其中儲存著關於mysql伺服器所維護的所有其他資料庫的資訊。查詢test database中的檢視 select from information schema.tables whe...

MySQL不同表查詢,不同資料庫查詢

內容比較弱 歡迎大神們指點 在mysql中 要實現不同表的查詢和不同資料庫的查詢,首先得有地方查吧 1 建立資料庫 create databaes test use test create table pet id int,name varchar 20 create table user id i...

mysql資料庫 多表查詢(表連線查詢

交叉連線的結果為笛卡爾積,所有連線方式都會先臨時生成笛卡爾積表。語法格式 select 查詢字段 from 表一 corss join 表二 nysql預設的連線方式為內連線。語法格式 select 查詢字段 from 表一 inner join 表二 on 表一.關係字段 表二.關係字段 wher...