欢迎投稿

今日深度:

postgresql的show databases、show tables、describe table操作

postgresql的show databases、show tables、describe table操作,describetable


1、相当与mysql的show databases;
select datname from pg_database;


2、相当于mysql的show tables;
SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';
public 是默认的schema的名字


3、相当与mysql的describe table_name;
SELECT column_name FROM information_schema.columns WHERE table_name ='table_name';
'table_name'是要查询的表的名字


显示所有数据库的sql语句是什?我知道mysql中可以用show databases; 显示表show tables;

select * from sysdatabases
或者执行系统存储过程
sp_helpdb
 

PostgreSQL 与Mysql对照

mysql:show databases
pgsql:\l 或者\l+(显示的信息要多一些)

mysql:use xx
pgsql:\c xx

mysql:show tables
pgsql:\dt
 

www.htsjk.Com true http://www.htsjk.com/shujukunews/2673.html NewsArticle postgresql的show databases、show tables、describe table操作,describetable 1、相当与mysql的show databases; select datname from pg_database; 2、相当于mysql的show tables; SELECT table_name FROM information_schema.tables WHERE...
评论暂时关闭