【学习笔记】PostgreSQL创建和删除表

创建表

  1. 基本语法
CREATE TABLE tablename( 
column1 datatype, 
column2 datatype, 
column3 datatype,..... 
columnN datatype,PRIMARY KEY( one or more columns ));

示例:

create table student(
id integer not null,
name varchar(20),
subject varchar(20),
constraint student_pkey primary key(id));

删除表

只需要一句语法就够了:

drop table student2;

猜你喜欢

转载自www.cnblogs.com/echizen/p/13379211.html
今日推荐