PostgreSQL common statement

postgres=# create database mydb;

CREATE DATABASE


postgres
=# alter database mydb;
ALTER DATABASE


postgres
=# create table mydbtable(name varchar(80),year int);
CREATE TABLE


postgres
=# create table mydbtable(name varchar(80),year int);
ERROR: relation
"mydbtable" already exists


postgres
=# insert into mydbtable (name,year) values ​​(' xiaoming',23);
INSERT
0 1


postgres
=# 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 1
postgres
=# select name from mydbtable;
name
----------
xiaoming
xiaohong
(
2 rows)



postgres
=# update mydbtable set name = '< span style="color: #800000;">xiaohei' where name='xiaohong'< /span>;
UPDATE
1
postgres
=# select name from mydbtable;
name
----------
xiaoming
xiaohei
(
2 rows)
postgres
=#


postgres
=# delete from mydbtable where name=< span style="color: #800000;">'
xiaohei' ;
DELETE
1
postgres
=# select name from mydbtable;
name
----------
xiaoming
(
1 row)


postgres
=# delete from mydbtable;
DELETE
1
postgres
=# select * from mydbtable;
name
| year
------+------
(
0 rows)
postgres
=#


postgres
=# create database testdb;
CREATE DATABASE


postgres
=# alter database testdb;
ALTER DATABASE

postgres=# create database mydb;

CREATE DATABASE


postgres
=# alter database mydb;
ALTER DATABASE


postgres
=# create table mydbtable(name varchar(80),year int);
CREATE TABLE


postgres
=# create table mydbtable(name varchar(80),year int);
ERROR: relation
"mydbtable" already exists


postgres
=# insert into mydbtable (name,year) values ​​(' xiaoming',23);
INSERT
0 1


postgres
=# 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 1
postgres
=# select name from mydbtable;
name
----------
xiaoming
xiaohong
(
2 rows)



postgres
=# update mydbtable set name = '< span style="color: #800000;">xiaohei' where name='xiaohong'< /span>;
UPDATE
1
postgres
=# select name from mydbtable;
name
----------
xiaoming
xiaohei
(
2 rows)
postgres
=#


postgres
=# delete from mydbtable where name=< span style="color: #800000;">'
xiaohei' ;
DELETE
1
postgres
=# select name from mydbtable;
name
----------
xiaoming
(
1 row)


postgres
=# delete from mydbtable;
DELETE
1
postgres
=# select * from mydbtable;
name
| year
------+------
(
0 rows)
postgres
=#


postgres
=# create database testdb;
CREATE DATABASE


postgres
=# alter database testdb;
ALTER DATABASE

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 728 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.