1、创建、删除数据库
create database database_name;
drop database database_name;
2、创建表
CREATE TABLE public.student2
(
id integer NOT NULL,
name character(100),
subjects character(1),
CONSTRAINT student2_pkey PRIMARY KEY (id)
)
WITH (
OIDS=FALSE
);
ALTER TABLE public.student2
OWNER TO postgres;
COMMENT ON TABLE public.student2
IS '这是一个学生信息表2';
删除表:
drop table table_name;
3、修改表字段
修改字段类型:
alter table szgc_building ALTER COLUMN parkid TYPE character varying(50);
修改字段名称:
alter table szgc_building rename parkid to parkname;
添加字段:
alter table szgc_building add column plon character varying(20);
删除字段:
alter table szgc_building drop column parkname;
网友评论