Tongue Twisters in SQL

I was playing round the other night can came up with this SQL to solve a popular tongue twister:

SELECT
COUNT(woodpile.is_chucked)
FROM
woodpile,
woodchuck
WHERE
woodchuck.can_chuck = 1
AND
woodpile.is_chucked = 1

Here is another one:

SELECT COUNT(pepper.picked) FROM pepper WHERE pepper.picked_by = ‘Peter Piper’

A couple more with the tongue twisters:

Which wristwatches are Swiss wristwatches?

SELECT watch.* FROM watch WHERE watch.make = ‘Swiss’

Which witch wished which wicked wish?

SELECT witch.name FROM witch WHERE witch.wish_type = ‘wicked’ AND witch.type = ‘wicked’

Who washed Washington’s white woolen underwear
when Washington’s washer woman went west?

SELECT
washer.name
FROM
washer
WHERE
washer.gender = ‘female’
AND
washer.went != ‘west’
AND
washer.washed = ‘underwear’
AND
washer.fabric = ‘wool’
AND
washer.washed_for = ‘Washington’

Leave a Reply

Your email address will not be published. Required fields are marked *