// SQL SELECT m.* FROM meme m JOIN (SELECT aid FROM meme GROUP BY aid HAVING SUM(CASE WHEN (rid='pres_order') THEN 1 ELSE 0 END) > 0 AND SUM(CASE WHEN (rid='child') THEN 1 ELSE 0 END) = 0) AS aids ON m.aid = aids.aid WHERE (rid='pres_order');
A | .R | :B | =Q |
---|---|---|---|
george_washington | .pres_order | :first | =1 |
james_madison | .pres_order | :first | =4 |
andrew_jackson | .pres_order | :first | =7 |
james_polk | .pres_order | :first | =11 |
james_buchanan | .pres_order | :first | =15 |
Example Queries (Help) | |
---|---|
qry.all | Show all data in this DB. |
george_washington | All about George Washington. |
.child | Who were children of the presidents? |
:lawyer | Which presidents were lawyers? |
.college:harvard | Which presidents attended Harvard for college? |
.pres_order=10 | Who was the tenth president? |
.college:columbia .occupation:lawyer | Which presidents attended Columbia and were lawyers? |
.pres_order>=20 .pres_order<=30 | Who were the twentieth through thirtieth presidents? |
.pres_order .child=f | Which presidents did NOT have children? |
.pres_order>=20 .pres_order<=30 .spouse=g | Who were the spouses of the twentieth through thirtieth presidents? |
.college:harvard .college:columbia qry.all | Use qry.all to return all memes related to the matching As. |