sql 常用语句,MySQL,SQLite,PgSQL,

— SQLite:
— 查看所有表

SELECT name FROM sqlite_master WHERE type='table';

MySQL:

SHOW TABLES;
SELECT TABLE_SCHEMA,table_name, table_type, engine, create_time,TABLE_ROWS,AVG_ROW_LENGTH FROM information_schema.tables ;
select * FROM information_schema.tables;

PgSQL:

WITH T2 AS( SELECT relname AS c_table_name, CAST(obj_description(relfilenode,'pg_class') AS VARCHAR) AS c_comment FROM pg_class )
SELECT tableowner AS t_owner,schemaname AS t_schema,tablename AS t_name,T2.*
FROM pg_tables AS T1 LEFT JOIN T2 ON T2.c_table_name = T1.tablename
WHERE T1.tablename NOT LIKE 'pg_%'

Leave a Reply

Your email address will not be published. Required fields are marked *