图书编号,图书名字,图书作者,图书分类。请创建一个图书表,并进行增删改查。
1.创建图书表
– craete table
–创建图书表
create table bookes
(
no varchar2(64),
name varchar2(20),
author varchar2(10)
);
–创建分类表
create table booknoes
(
no varchar2(64),
categroy varchar2(10)
)
2.插入数据
–插入数据
–insert into 表名(各个列明)
–values(各列对应的值)
insert into bookes(no,name,author)
values(‘11’,‘茶花女’,‘斯当达’);
insert into bookes(no,name,author)
values(‘12’,‘红与黑’,‘亚历山大’);
insert into bookes(no,name,author)
values(‘13’,‘童年’,‘高尔基’);
insert into bookes(no,name,author)
values(‘14’,‘百年孤独’,‘马尔克斯’);
insert into bookes(no,name,author)
values(‘21’,‘圣母院’,‘雨果’);
insert into bookes(no,name,author)
values(‘22’,‘明朝那些事’,‘当年明月’);
insert into bookes(no,name,author)
values(‘31’,‘铁血兵戈’,‘风中的失落’);
insert into bookes(no,name,author)
values(‘32’,‘路过’,‘张嘉佳’);
insert into booknoes(no,categroy)
values(‘1’,‘文学名著’);
insert into booknoes(no,categroy)
values (‘2’,‘武侠’);
insert into booknoes(no,categroy)
values (‘3’,‘网络小说’);
3.查看表
select * from bookes
select * from booknoes
4.查找数据
–select 列名 from 表名 [where 筛选条件]
select no,name from bookes where name=‘圣母院’;
select no,categroy from booknoes where categroy=‘武侠’;
5.修改数据
–update student set 列名=值 [where 筛选条件]
–更新数据
update bookes set name=‘巴黎圣母院’ where name=‘圣母院’;
update booknoes set categroy=‘历史军事’ where categroy=‘武侠’;
6.删除数据
–delete from 表名 [where 筛选条件]
delete from bookes where name=‘红与黑’;