add src/sql/queries/word-count-by-verse.sql

This commit is contained in:
0x1eef 2022-06-29 04:19:22 -03:00
parent 02b1c31433
commit a0637960b3

View file

@ -0,0 +1,24 @@
-- | DESCRIPTION
--
-- This query counts the number of verses where a
-- given word (or phrase) appears.
--
-- | EXAMPLE RESULT SET
--
-- word verses
-- ----- -------
-- Allah 2001
SELECT
"Allah" AS word,
COUNT(verses.id) AS verses
FROM
verses
INNER JOIN qurans ON qurans.id = verses.quran_id
INNER JOIN chapters ON chapters.id = verses.chapter_id
WHERE
qurans.locale = "en"
AND verses.content LIKE '%' || word || '%'
LIMIT
1;