MySQL

Implementation of programming language SQL

MySQL is a relational database management system created by MySQL AB (now a subsidiary of Sun Microsystems). It can either be used as free software under GNU GPL or be purchased under proprietary license.

MySQL is the most popular database component for web-based applications (due to ease of its combining with PHP) and is widely used in free software projects which require a full-featured RDBMS.

MySQL uses procedural extension called SQL/PSM (for SQL/Persistent Stored Module), developed by ANSI and defined in ISO/IEC 9075-4:2003 standard.

Examples:

Factorial:

Example for versions MySQL 3.23.57

Replace TABLE with name of any table you have access to, like mysql.help_topic.

select concat(cast(t2.n as char), "! = ",  cast(exp(sum(log(t1.n))) as char))
  from 
  ( select @i := @i+1 AS n
      from TABLE, (select @i := 0) as sel1
      limit 16 ) t1,
  ( select @j := @j+1 AS n
      from TABLE, (select @j := 0) as sel1
      limit 16 ) t2
 where t1.n <= t2.n
 group by t2.n

Fibonacci numbers:

Example for versions MySQL 3.23.57

Replace TABLE with name of any table you have access to, like mysql.help_topic.

select concat(group_concat(f separator ', '), ', ...')
from (select @f := @i + @j as f, @i := @j, @j := @f
        from TABLE, (select @i := 1, @j := 0) sel1
       limit 16) t

Hello, World!:

Example for versions Microsoft SQL Server 2005, Microsoft SQL Server 2008 R2, Microsoft SQL Server 2012, MySQL 3.23.57, PostgreSQL 9.1
select 'Hello, World!';