返回顶部

【学习笔记】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;
posted @ 2020-07-26 09:03  藤原豆腐店の張さん  阅读(180)  评论(0编辑  收藏  举报