Home > Database > Mysql Tutorial > postgres

postgres

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 15:54:24
Original
1177 people have browsed it

postgres 连接数据库, 默认的用户和数据库是postgrespsql -U user -d dbname切换数据库,相当于mysql的use dbname\c dbname列举数据库,相当于mysql的show databases\l列举表,相当于mysql的show tables\dt查看表结构,相当于desc tblname,show columns from

postgres

连接数据库, 默认的用户和数据库是postgres
psql -U user -d dbname

切换数据库,相当于mysql的use dbname
\c dbname
列举数据库,相当于mysql的show databases
\l
列举表,相当于mysql的show tables
\dt
查看表结构,相当于desc tblname,show columns from tbname
\d tblname

\di 查看索引 

创建数据库: 
create database [数据库名]; 
删除数据库: 
drop database [数据库名];  
*重命名一个表: 
alter table [表名A] rename to [表名B]; 
*删除一个表: 
drop table [表名]; 
Copy after login
ps aux | grep postgres
Copy after login
psql postgres
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template