Compare commits
No commits in common. "621b846797551e656dc0761a8221928347b2dc15" and "53aacb1dee120f84fc794b34837467b48524eb7c" have entirely different histories.
621b846797
...
53aacb1dee
@ -243,21 +243,7 @@ WHERE b.note = a.author_name
|
|||||||
GROUP BY a.author_id
|
GROUP BY a.author_id
|
||||||
HAVING COUNT(*) > 1;
|
HAVING COUNT(*) > 1;
|
||||||
|
|
||||||
#9 视图
|
|
||||||
CREATE VIEW v_book AS
|
|
||||||
SELECT b.genre, a.author_name, COUNT(*) c
|
|
||||||
FROM tb_books b, tb_authors a
|
|
||||||
WHERE b.note = a.author_name
|
|
||||||
GROUP BY b.genre, a.author_id
|
|
||||||
HAVING COUNT(*) = ( #子查询用来统计这个类别中 数量最多的作者的图书数量
|
|
||||||
SELECT COUNT(*)
|
|
||||||
FROM tb_books
|
|
||||||
WHERE b.genre = genre
|
|
||||||
GROUP BY note
|
|
||||||
ORDER BY COUNT(*) DESC
|
|
||||||
LIMIT 1
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
#9
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user