图书管理系统:
1、图书表
create table book(
id int primary key,
name varchar(20),
author vachar(20),
price decimal(11,2),
category_id int,
foreign key(caregory_id) references category(id)
)
2、学生表
create table student(
id int primary key,
name varchar(20)
)
3、图书分类表
create table category(
id int primary key,
name varchar(20)
);
4、图书借阅信息表(中间表)
create table borrow_info(
id int primary key,
book_id int,
student_id int,
start_time timestamp null,
end_time timestamp null,
foreign key (book_id) references book(id),
foreign key (student_id) references student(id)
)
问题:
1、查询某个分类下的图书信息,“计算机”
select b.id,b.name,b.author,b.price,c.`name`,c.id from book b join catego