SQL 创建视图以计算订单总数

SQL Create view to count total number of orders

请帮助创建任务视图:

"创建一个视图,其中包含有关每本书的订单总数的信息。 该视图必须包含两列:"book title" 和 "number of orders"."

书名是 "name",table book - kniga and orders - zakaz

create view info_books as select kniga.name  from zakaz, kniga group by kniga.name;
select * from info_books;

但我想我应该得到

name | count 
ee | 2 
ew | 1
few | 1

这是我的例子:https://www.db-fiddle.com/f/gtXitKPGLYwz5QQPr1LZDX/2

或在这里:

CREATE TABLE zakaz (
  `id_zakaz` INTEGER,
  `id_chit` INTEGER, 
  `data` INTEGER, 
  `id_knigi` INTEGER
);
CREATE TABLE kniga (
  `id_knigi` INTEGER,
  `author` CHAR(30), 
  `name` CHAR(30)
);


INSERT INTO zakaz
  (`id_zakaz`, `id_chit`, `data`, `id_knigi`)
VALUES
  ('1', '1', '123', '33'),
  ('5', '31', '414', '53'),
  ('7', '3', '523', '33'),
  ('4', '4', '52342', '54');

INSERT INTO kniga
  (`author`, `name`, `id_knigi`)
VALUES
  ('abc', 'ee', '33'),
  ('cfe', 'ew', '53'),
  ('feaq', 'fewda', '54');

您可以试试这个查询:

CREATE VIEW info_books AS
SELECT K.name, COUNT(*) AS 'Count'
FROM zakaz AS Z LEFT JOIN kniga AS K ON Z.id_knigi=K.id_knigi GROUP BY K.name;

SELECT * FROM info_books;