1. 删除数据库
-bash-3.2$ createdb abc -O testuser
CREATE DATABASE
-bash-3.2$ dropdb abc //dropdb删除数据库
DROP DATABASE
-bash-3.2$ createdb abc -O testuser
CREATE DATABASE
-bash-3.2$ psql -U testuser -d testuser
Welcome to psql 8.1.23,the Postgresql interactive terminal.
Type: \copyright for distribution terms
\h for help with sql commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
testuser=> drop database abc; //登录后的删除数据库,注意,不能删除当前登录的数据库
DROP DATABASE
-bash-3.2$ createdb abc -O testuser
CREATE DATABASE
-bash-3.2$ dropdb abc //dropdb删除数据库
DROP DATABASE
-bash-3.2$ createdb abc -O testuser
CREATE DATABASE
-bash-3.2$ psql -U testuser -d testuser
Welcome to psql 8.1.23,the Postgresql interactive terminal.
Type: \copyright for distribution terms
\h for help with sql commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
testuser=> drop database abc; //登录后的删除数据库,注意,不能删除当前登录的数据库
DROP DATABASE
2. 删除索引
ERROR: cannot drop index testuser_id_pk because constraint testuser_id_pk on table test requires it
HINT: You may drop constraint testuser_id_pk on table test instead.
testuser_test=# drop index unique_name; //删除索引
DROP INDEX
HINT: You may drop constraint testuser_id_pk on table test instead.
testuser_test=# drop index unique_name; //删除索引
DROP INDEX
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。