Friday, August 23, 2013

Redundant SQL

Today I wrote some SQL that, when spoke, sounded like "select client from client as client", written:

select  (select client from client) as client ...

Then I thought, could I actually write something even more ridiculous? What about "select select as as from from", and so I came up with:

create table "from" as select 'select' as "select" from dummy;
select "select" as "as" from "from";

The result is a one-cell table:


The table "dummy" is an empty table, used for "selecting" from something not actually in any table. The double quotes make the SQL execute even though it is using special keywords.

I tried adding a "group by group" and an "order by order", but that didn't work as I would have thought. I guess I can take this silliness only so far.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.