分析下总训练4需要的数据形式

图书管理系统

所有页面的sql语句 oracle的sql语句与mysql不同

与训练2不同 直接查询所有数据 不是根据type 分类查询

2.遇到问题

  • js 请求是异步的 请求的数据没到 接着往下执行
  • 可我要使用请求的数据 这时总是undefined
  • 如何解决???

1.图书管理主页面

1
2
3
4
5
6
7
8
9
SELECT t.tid_ ,bname_, c.cname_,t.tname_
from book_type t ,book_category c ,book_info i
where t.cid_=c.cid_ and t.tid_=i.tid_ ;

- 分页查询
```java
select e.* from(select rownum r, e1.* from(SELECT t.tid_ ,bname_, c.cname_,t.tname_
from book_type t ,book_category c ,book_info i
where t.cid_=c.cid_ and t.tid_=i.tid_)e1)e where e.r>14 and e.r<29;
  • 获取图书管理数据总数
1
2
3
select count(*) f from(SELECT t.tid_ ,bname_, c.cname_,t.tname_
from book_type t ,book_category c ,book_info i
where t.cid_=c.cid_ and t.tid_=i.tid_);

1.1 新建图书

1
2


2.记录查询主页面

1
2
3
SELECT bname_, person_,fromdate_,todate_
from book_type t ,book_category c ,book_info i,book_history h
where t.cid_=c.cid_ and t.tid_=i.tid_ and i.bid_=h.bid_;
  • 分页查询
1
2


3.统计图

1
2
3
4
SELECT bname_, count(bname_)
from book_type t ,book_category c ,book_info i,book_history h
where t.cid_=c.cid_ and t.tid_=i.tid_ and i.bid_=h.bid_
group by bname_;
  • 分页查询
1
2
3
4
select e.bname_ ,count(e.bname_) from(select rownum r, e1.* from(SELECT bname_, person_,fromdate_,todate_
from book_type t ,book_category c ,book_info i,book_history h
where t.cid_=c.cid_ and t.tid_=i.tid_ and i.bid_=h.bid_)e1)e where e.r>1 and e.r<29
group by bname_;

4.分页查询

  • how2j模板
1
2
3
4
5
6
select * from
(select rownum r, e1.* from
(
select e.* from hr.employees e order by e.salary desc
) e1
) e2 where e2.r >=5 and e2.r<=10
1
2
3
4
5
select e.* from(select rownum r, e1.* from(SELECT bname_, count(bname_)
from book_type t ,book_category c ,book_info i,book_history h
where t.cid_=c.cid_ and t.tid_=i.tid_ and rownum<=15
and i.bid_=h.bid_
group by bname_ )e1)e where e.r>14 and e.r<29;