postgresql-表的插入和建立,删除

声明:本PostgreSQl实用指南系列为刘兴(http://deepfuture.iteye.com/)原创,未经笔者授权,任何人和机构不能转载

进入sql解释器
D:\pgsql>psql mydb
psql (8.4.2)
Type "help" for help.

检查版本

mydb=# select * from version();
                           version
-------------------------------------------------------------
 PostgreSQL 8.4.2, compiled by Visual C++ build 1400, 32-bit
(1 row)

创建表
mydb=# create table stuedent(
mydb(#  name varchar(20),
mydb(# age int,
mydb(# tel int
mydb(# );
CREATE TABLE

mydb=# select * from stuedent;
 name | age | tel
------+-----+-----
(0 rows)

删除表

mydb=#drop table stuedent
mydb-# ;
DROP TABLE

检验是否删除

mydb=# select * from stuedent;
ERROR:  relation "stuedent" does not exist
LINE 1: select * from stuedent;
                      ^

 

插入数据

 mydb=# create table student(name varchar(20),age int);
CREATE TABLE
mydb=# insert into student values('deepfuture',20);
INSERT 0 1
mydb=# insert into student values('未来',20);
INSERT 0 1


mydb=# select * from student;
    name    | age
------------+-----
 deepfuture |  20
 未来       |  20
(2 rows)

你可能感兴趣的:(sql,C++,c,C#,PostgreSQL)