add src/sql/queries/word-count-by-verse.sql
This commit is contained in:
parent
02b1c31433
commit
a0637960b3
1 changed files with 24 additions and 0 deletions
24
src/sql/queries/word-count-by-verse.sql
Normal file
24
src/sql/queries/word-count-by-verse.sql
Normal 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;
|
Loading…
Reference in a new issue