On 03/08/2014 08:53 PM, Kees Nuyt wrote:
Someone called zzo38 posted a quine (self-replicating program)
on Internet Relay Chat in network: Freenode, channel: #sqlite

[2014-03-08 11:01:59] < zzo38> I made a quine program in SQL.
[2014-03-08 11:02:10] < zzo38>

with q(q) as
(select 'with q(q) as (select ''#'') select
replace(q,x''23'',replace('''''''','''''''''''')) from q;')
select replace(q,x'23',replace(q,'''','''''')) from q;

[2014-03-08 11:02:52] < zzo38> Do you like quine program in SQL?
[2014-03-08 11:03:06] < zzo38> Maybe do you have a better (shorter) one?

Note:
        SQL preferably written as a oneliner
References:
        http://en.wikipedia.org/wiki/Quine_(computing)
        http://sqlite.org/lang_with.html

Enjoy!



SELECT REPLACE(q, 8-8, quote(q)) FROM (SELECT 'SELECT REPLACE(q, 8-8, quote(q)) FROM (SELECT 0 AS q);' AS q);



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to