成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

MySQL常用查詢Databases和Tables

數(shù)據(jù)庫(kù) MySQL
本篇文章分享一下工作中常見(jiàn)的MySQL腳本,具體內(nèi)容如下,我們一起來(lái)看。

分享一下工作中常見(jiàn)的mysql腳本,此次分享的內(nèi)容如下:

  • Databases
  • tables

一、Databases and schemas

列出了 MySQL 實(shí)例上的用戶數(shù)據(jù)庫(kù)(模式):

select schema_name as database_name
from information_schema.schemata
where schema_name not in('mysql','information_schema',
'performance_schema','sys')
order by schema_name

說(shuō)明:database_name - 數(shù)據(jù)庫(kù)(模式)名稱。

二、Tables

1. 列出 MySQL 數(shù)據(jù)庫(kù)中的表

下面的查詢列出了當(dāng)前或提供的數(shù)據(jù)庫(kù)中的表。要列出所有用戶數(shù)據(jù)庫(kù)中的表

(1) 當(dāng)前數(shù)據(jù)庫(kù)

select table_schema as database_name,
table_name
from information_schema.tables
where table_type = 'BASE TABLE'
and table_schema = database()
order by database_name, table_name;

說(shuō)明:

  • table_schema - 數(shù)據(jù)庫(kù)(模式)名稱
  • table_name - 表名

(2) 指定數(shù)據(jù)庫(kù)

select table_schema as database_name,
table_name
from information_schema.tables
where table_type = 'BASE TABLE'
and table_schema = 'database_name' -- enter your database name here
order by database_name, table_name;

說(shuō)明:

  • table_schema - 數(shù)據(jù)庫(kù)(模式)名稱
  • table_name - 表名

2. 列出 MySQL 中所有數(shù)據(jù)庫(kù)的表

下面的查詢列出了所有用戶數(shù)據(jù)庫(kù)中的所有表:

select table_schema as database_name,
table_name
from information_schema.tables
where table_type = 'BASE TABLE'
and table_schema not in ('information_schema','mysql',
'performance_schema','sys')
order by database_name, table_name;

說(shuō)明:

  • table_schema - 數(shù)據(jù)庫(kù)(模式)名稱
  • table_name - 表名

3. 列出 MySQL 數(shù)據(jù)庫(kù)中的 MyISAM 表

select table_schema as database_name,
table_name
from information_schema.tables tab
where engine = 'MyISAM'
and table_type = 'BASE TABLE'
and table_schema not in ('information_schema', 'sys',
'performance_schema','mysql')
-- and table_schema = 'your database name'
order by table_schema,
table_name;

說(shuō)明:

  • database_name - 數(shù)據(jù)庫(kù)(模式)名稱
  • table_name - 表名

4. 列出 MySQL 數(shù)據(jù)庫(kù)中的 InnoDB 表

select table_schema as database_name,
table_name
from information_schema.tables tab
where engine = 'InnoDB'
and table_type = 'BASE TABLE'
and table_schema not in ('information_schema', 'sys',
'performance_schema','mysql')
-- and table_schema = 'your database name'
order by table_schema,
table_name;

說(shuō)明:

  • database_name - 數(shù)據(jù)庫(kù)(模式)名稱
  • table_name - 表名

5. 識(shí)別 MySQL 數(shù)據(jù)庫(kù)中的表存儲(chǔ)引擎(模式)

select table_schema as database_name,
table_name,
engine
from information_schema.tables
where table_type = 'BASE TABLE'
and table_schema not in ('information_schema','mysql',
'performance_schema','sys')
-- and table_schema = 'your database name'
order by table_schema,
table_name;

說(shuō)明:

(1)table_schema - 數(shù)據(jù)庫(kù)(模式)名稱

(2)table_name - 表名

(3)engine- 表存儲(chǔ)引擎。可能的值:

  • CSV
  • InnoDB
  • 記憶
  • MyISAM
  • 檔案
  • 黑洞
  • MRG_MyISAM
  • 聯(lián)合的

6. 在 MySQL 數(shù)據(jù)庫(kù)中查找最近創(chuàng)建的表

select table_schema as database_name,
table_name,
create_time
from information_schema.tables
where create_time > adddate(current_date,INTERVAL -60 DAY)
and table_schema not in('information_schema', 'mysql',
'performance_schema','sys')
and table_type ='BASE TABLE'
-- and table_schema = 'your database name'
order by create_time desc,
table_schema;

MySQL 數(shù)據(jù)庫(kù)中最近 60 天內(nèi)創(chuàng)建的所有表,按表的創(chuàng)建日期(降序)和數(shù)據(jù)庫(kù)名稱排序

說(shuō)明:

  • database_name - 表所有者,模式名稱
  • table_name - 表名
  • create_time - 表的創(chuàng)建日期

7. 在 MySQL 數(shù)據(jù)庫(kù)中查找最近修改的表

select table_schema as database_name,
table_name,
update_time
from information_schema.tables tab
where update_time > (current_timestamp() - interval 30 day)
and table_type = 'BASE TABLE'
and table_schema not in ('information_schema', 'sys',
'performance_schema','mysql')
-- and table_schema = 'your database name'
order by update_time desc;

所有數(shù)據(jù)庫(kù)(模式)中最近 30 天內(nèi)最后修改的所有表,按更新時(shí)間降序排列

說(shuō)明:

  • database_name - 數(shù)據(jù)庫(kù)(模式)名稱
  • table_name - 表名
  • update_time - 表的最后更新時(shí)間(UPDATE、INSERT 或 DELETE 操作或 MVCC 的 COMMIT)
責(zé)任編輯:趙寧寧 來(lái)源: 今日頭條
相關(guān)推薦

2021-03-02 12:34:47

MySQL解鎖表鎖定表

2022-05-30 06:30:20

查詢MySQL數(shù)據(jù)庫(kù)

2018-12-24 18:12:41

SQL ServerMySQL數(shù)據(jù)庫(kù)

2018-03-29 19:45:47

數(shù)據(jù)庫(kù)MySQL查詢優(yōu)化

2019-03-25 19:13:37

MySQL常用工具數(shù)據(jù)庫(kù)

2019-08-14 15:18:55

MySQLSQL數(shù)據(jù)庫(kù)

2018-10-12 16:45:10

MySQL查詢?nèi)罩?/a>數(shù)據(jù)庫(kù)

2018-06-07 08:54:01

MySQL性能優(yōu)化索引

2021-04-09 23:00:12

SQL數(shù)據(jù)庫(kù)Pandas

2010-11-25 10:21:20

MySql查詢時(shí)間段

2009-08-05 10:08:55

MySQL查詢優(yōu)化調(diào)度鎖定

2011-03-03 16:10:04

Mysql數(shù)據(jù)庫(kù)備份還原

2021-01-28 23:26:55

MySQL

2021-07-05 09:24:06

MySQL SQL 語(yǔ)句數(shù)據(jù)庫(kù)

2017-09-01 21:00:05

MySQLSQL優(yōu)化查詢方法

2010-05-27 16:12:10

MySQL索引

2013-05-17 10:43:32

2017-09-18 15:20:02

MySQL慢查詢?nèi)罩?/a>配置

2009-06-16 10:36:00

Google Fusi應(yīng)用實(shí)例

2010-11-25 13:05:26

MySQL列類型
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)

主站蜘蛛池模板: 福利视频一区二区 | 日韩毛片| 色吧色综合 | 亚洲精品久久视频 | 91麻豆精品国产91久久久久久 | 综合色久| 在线免费观看欧美 | a免费观看 | 精品国产乱码久久久久久蜜柚 | 婷婷综合 | 狼色网 | 免费看爱爱视频 | 亚洲狠狠爱 | 成人在线播放网站 | 免费观看的黄色网址 | 国产玖玖| 亚洲精品久久久久久一区二区 | 欧美久久久电影 | 91在线资源 | 久久国产精品-久久精品 | 国产超碰人人爽人人做人人爱 | 韩国精品一区二区三区 | 日本黄色大片免费 | 国产欧美一级二级三级在线视频 | 91国产精品 | 一区二区三区国产 | 国产成人精品a视频一区www | av片在线观看网站 | 成人免费视频一区二区 | 黄视频免费观看 | 精品国产综合 | 天天夜天天操 | 国产精品电影在线观看 | 最近日韩中文字幕 | 中文字幕在线播放不卡 | 91av视频在线免费观看 | 亚洲成人精品一区二区 | 午夜爽爽爽男女免费观看影院 | 福利网址| 国产精品久久久久久久久久免费 | 中文字幕第二十页 |