1 Star 0 Fork 0

王浩天 / MyNote

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
LocalhostDataBase.sql 1.83 KB
一键复制 编辑 原始数据 按行查看 历史
王浩天 提交于 2021-10-19 18:32 . sql
create table t_catalog(
n_id integer primary key,
c_name varchar(200)
)
insert into t_catalog(n_id,c_name)
values(1,'生活用品'),(2,'零食');
select tp.n_id,tp.c_name,tc.c_name,tp.n_price,tp.dt_startdate,tp.n_count,tp.c_describe
from t_product tp
left join t_catalog tc on tp.n_catalog = tc.n_id
create table t_book(
n_id integer,
c_name varchar(200) not null,
c_isbn varchar(100) not null,
n_author integer not null,
n_press integer not null,
primary key(n_id)
);
create table t_author(
n_id integer primary key,
c_name varchar(200) not null,
c_gender varchar(10),
c_country varchar(50)
);
create table t_press(
n_id integer primary key,
c_name varchar(200) not null,
c_address varchar(300)
);
insert into t_author (n_id,c_name,c_gender,c_country)
values
(1,'瑞·达利欧','男','美国'),
(2,'森田直行','男','日本'),
(3,'卡勒德·胡赛尼','男','阿富汗'),
(4,'克里斯蒂娜·沃特克','女','美国'),
(5,'东野圭吾','男','日本');
insert into t_press (n_id,c_name,c_address)
values
(1,'中信出版社','北京市朝阳区小关街道惠新东街甲四号富盛大厦2座'),
(2,'机械工业出版社','北京市西城区百万庄大街22号'),
(3,'上海人民出版社','上海市卢湾区绍兴路54'),
(4,'南海出版公司','海口市龙华区海秀中路51-1号星华大厦5楼');
insert into t_book (n_id,c_name,c_isbn,n_author,n_press)
values
(1,'原则','9787508684031',1,1),
(2,'阿米巴经营','9787111502197',2,2),
(3,'追风筝的人','9787208061644',3,3),
(4,'OKR工作法','9787508679099',4,1),
(5,'解忧杂货店','9787544298995',5,4);
alter table t_book
add n_price numeric(10,2) not null default 0;
update t_book
set n_price = '45.8'
where c_name ='原则';
update t_book
set n_price = '21.6'
where c_name ='阿米巴经营';
update t_book
set n_price = '11.9'
where c_name ='追风筝的人';
update t_book
set n_price = '30.4'
where c_name ='OKR工作法';
update t_book
set n_price = '15.3'
where c_name ='解忧杂货店';
1
https://gitee.com/wanghaotian123/my-no.git
git@gitee.com:wanghaotian123/my-no.git
wanghaotian123
my-no
MyNote
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891