postgres=# create database mydb;CREATE DATABASEpostgres=# alter database mydb;ALTER DATABASEpostgres=# create table mydbtable(name varchar(80),year int);CREATE tablepostgres=# create table mydbtable(name varchar(80),year int);ERROR: relation "mydbtable" already existspostgres=# insert into mydbtable (name,year) values (‘xiaoming‘,23);INSERT 0 1postgres=# table mydbtable; name | year ----------+------ xiaoming | 23(1 row)postgres=# select * from mydbtable; name | year ----------+------ xiaoming | 23(1 row)postgres=# select name from mydbtable; name ---------- xiaoming(1 row)postgres=# insert into mydbtable (name,year) values (‘xiaohong‘,23);INSERT 0 1postgres=# select name from mydbtable; name ---------- xiaoming xiaohong(2 rows)postgres=# update mydbtable set name = ‘xiaohei‘ where name=‘xiaohong‘;UPDATE 1postgres=# select name from mydbtable; name ---------- xiaoming xiaohei(2 rows)postgres=# postgres=# delete from mydbtable where name=‘xiaohei‘;DELETE 1postgres=# select name from mydbtable; name ---------- xiaoming(1 row)postgres=# delete from mydbtable;DELETE 1postgres=# select * from mydbtable; name | year ------+------(0 rows)postgres=# postgres=# create database testdb;CREATE DATABASEpostgres=# alter database testdb;ALTER DATABASE总结
以上是内存溢出为你收集整理的PostgreSQL 常用语句全部内容,希望文章能够帮你解决PostgreSQL 常用语句所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)