LoginSignup
2
3

More than 5 years have passed since last update.

[MySQL] よく使うけどたまに忘れるお役立ちクエリのメモ

Posted at

全テーブルのレコード数

SELECT table_name, table_rows FROM information_schema.TABLES

列情報の取得

SELECT table_name, column_name, data_type FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '[DB名]' ORDER BY TABLE_NAME;

実行中の書き込みクエリ

SELECT `time`, `info` FROM information_schema.PROCESSLIST WHERE `state` = 'update';

UNIX TIMEへ変換

SELECT unix_timestamp(now());
SELECT unix_timestamp('2010-01-01 11:22:33');

datetime型へ変換

SELECT from_unixtime(1292120553);
SELECT from_unixtime(unix_timestamp());
2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3