User Tools

Site Tools


sample_queries

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
sample_queries [2019/03/24 15:01]
steve
sample_queries [2019/03/24 18:28]
steve [Sample Queries]
Line 5: Line 5:
 In each query, it's important to remember to order the output by the verse IDs, since the natural ordering may shift around if you've made changes to your database. That possibility is rare, but it's going to keep your queries safe. In each query, it's important to remember to order the output by the verse IDs, since the natural ordering may shift around if you've made changes to your database. That possibility is rare, but it's going to keep your queries safe.
  
 +If you think of some cool queries, or want help writing some, [[http://​wonkabar.org/​contact-me|contact me]] and it'd be fun to figure out!
 ===== Synoptic Gospels ===== ===== Synoptic Gospels =====
  
-Query all the verses from the Synoptic Gospels ​in the New Testament of the King James Version of the Holy Bible (Matthew, Mark, and Luke):+Query all the verses from the Synoptic Gospels (Matthew, Mark, and Luke):
  
 <​code>​ <​code>​
Line 31: Line 32:
 Matthew 1:14|And Azor begat Sadoc; and Sadoc begat Achim; and Achim begat Eliud; Matthew 1:14|And Azor begat Sadoc; and Sadoc begat Achim; and Achim begat Eliud;
 Matthew 1:15|And Eliud begat Eleazar; and Eleazar begat Matthan; and Matthan begat Jacob; Matthew 1:15|And Eliud begat Eleazar; and Eleazar begat Matthan; and Matthan begat Jacob;
-Matthew 1:16|And Jacob begat Joseph the husband of Mary, of whom was born Jesus, who is called Christ. 
-Matthew 1:17|So all the generations from Abraham to David are fourteen generations;​ and from David until the carrying away into Babylon are fourteen generations;​ and from the carrying away into Babylon unto Christ are fourteen generations. 
-Matthew 1:18|Now the birth of Jesus Christ was on this wise: When as his mother Mary was espoused to Joseph, before they came together, she was found with child of the Holy Ghost. 
-Matthew 1:19|Then Joseph her husband, being a just man, and not willing to make her a publick example, was minded to put her away privily. 
-Matthew 1:20|But while he thought on these things, behold, the angel of the Lord appeared unto him in a dream, saying, Joseph, thou son of David, fear not to take unto thee Mary thy wife: for that which is conceived in her is of the Holy Ghost. 
-Matthew 1:21|And she shall bring forth a son, and thou shalt call his name Jesus: for he shall save his people from their sins. 
-Matthew 1:22|Now all this was done, that it might be fulfilled which was spoken of the Lord by the prophet, saying, 
-Matthew 1:​23|Behold,​ a virgin shall be with child, and shall bring forth a son, and they shall call his name Emmanuel, which being interpreted is, God with us. 
-Matthew 1:24|Then Joseph being raised from sleep did as the angel of the Lord had bidden him, and took unto him his wife: 
-Matthew 1:25|And knew her not till she had brought forth her firstborn son: and he called his name Jesus. 
-Matthew 2:1|Now when Jesus was born in Bethlehem of Jud&​aelig;​a in the days of Herod the king, behold, there came wise men from the east to Jerusalem, 
-Matthew 2:2|Saying, Where is he that is born King of the Jews? for we have seen his star in the east, and are come to worship him. 
-Matthew 2:3|When Herod the king had heard these things, he was troubled, and all Jerusalem with him. 
-Matthew 2:4|And when he had gathered all the chief priests and scribes of the people together, he demanded of them where Christ should be born. 
-Matthew 2:5|And they said unto him, In Bethlehem of Jud&​aelig;​a:​ for thus it is written by the prophet, 
 </​code>​ </​code>​
  
 +===== Random Book of Psalms =====
  
 +Display the verses from one chapter of the book of Psalms chosen randomly:
 +
 +<​code>​
 +SELECT v.scripture_text FROM verses v WHERE v.chapter_id IN (SELECT c.id FROM chapters c JOIN books b ON b.id = c.book_id WHERE b.book_title = '​Psalms'​ ORDER BY RANDOM() LIMIT 1) ORDER BY v.id;
 +</​code>​
 +
 +Result:
 +
 +<​code>​
 +Praise ye the Lord. Praise ye the Lord from the heavens: praise him in the heights.
 +Praise ye him, all his angels: praise ye him, all his hosts.
 +Praise ye him, sun and moon: praise him, all ye stars of light.
 +Praise him, ye heavens of heavens, and ye waters that be above the heavens.
 +Let them praise the name of the Lord: for he commanded, and they were created.
 +He hath also stablished them for ever and ever: he hath made a decree which shall not pass.
 +Praise the Lord from the earth, ye dragons, and all deeps:
 +Fire, and hail; snow, and vapour; stormy wind fulfilling his word:
 +Mountains, and all hills; fruitful trees, and all cedars:
 +Beasts, and all cattle; creeping things, and flying fowl:
 +Kings of the earth, and all people; princes, and all judges of the earth:
 +Both young men, and maidens; old men, and children:
 +Let them praise the name of the Lord: for his name alone is excellent; his glory is above the earth and heaven.
 +He also exalteth the horn of his people, the praise of all his saints; even of the children of Israel, a people near unto him. Praise ye the Lord.
 +</​code>​
sample_queries.txt · Last modified: 2019/03/24 18:28 by steve