# 创建数据库
postgres=# create database test;
不用断开连接 就可以连接到其他数据库
\c 可以连接其他数据库名字
删除数据库库 drop database test;
\q 断开连接的所有数据库
或者在pg里面点击
server -- discount server
\c test;
test=# create table company(id int primary key not null , name text not null , age int not null ,address char(50) , salary real);
这里id 设置为primay key 因此值不能为空,
name text格式 不能为空
age 整数 不能为空
adress 字符串 50bites以内 可以为空
salary real 可以为空
emp_id 表示 employee 员工
constraint 约束 限制
首先要\c 连接到对应数据库 再输入:
drop table sudent;
/d 查看删除后的目录结构
至此,第四章看完
https://www.youtube.com/watch?v=4EOzwZ1kjRQ&list=PLk1kxccoEnNEtwGZW-3KAcAlhI_Guwh8x&index=4
原文:https://www.cnblogs.com/sunnywillow/p/13294303.html