表格类型
GENRE_CATEGORY DESCRIPTION
-------------- ----------------------
C100 Information Technology
C200 Novel
C300 Cookery
C400 Lifestyle
表格书
ISBN TITLE PAGE_NUMBER PUBLICATION_YEAR PUBLISHER_CODE GENRE_CATEGORY
------------ ----------------- ----------- ---------------- -------------- --------------
123-0-12-374 Rainbow Mountain 200 2011 P2001 C200
989-2-96-545 Data Mining 340 2012 P2002 C100
718-8-16-555 Asian Food 280 2013 P3002 C300
674-9-90-345 Yoga for the mind 180 2016 P2002 C400
900-0-88-767 Finding Rainbow 250 2016 P2001 C200
888-9-55-447 Pastry Heaven 200 2016 P3002 C300
我需要编写什么sql语句来生成一个包含发布商代码,描述,书籍数量的表格(计算使用计数的书籍数量)。 该表必须显示有多少本书适用于小说,信息技术,生活方式和烹饪。我花了两个小时试图弄清楚该怎么做请帮帮我
select Publisher_Code,Description, count(genre_category)
from genre
INNER Join book
ON genre.genre_category=book.genre_category
where(genre.genre_category=book.genre_category);
答案 0 :(得分:0)
我认为这就是你要找的......
select Publisher_Code, Description, count(*)
from genre
INNER Join book
ON genre.genre_category=book.genre_category
GROUP BY Publisher_Code, Description;