Posts

Showing posts from September, 2019

MYSQL Select without from (values table constructor)

[From  https://modern-sql.com/use-case/select-without-from ] Select  without  from Let's get that straight from the beginning:  select  without  from  is not standard conforming SQL. Full stop. Nevertheless it works in many databases—also in standard conforming ones. That's no contradiction: the standard explicitly allows conforming databases to “provide user options to process non-conforming SQL statements”. 0  The behavior of such statements is completely up to the vendor, of course. So what alternative does the standard offer to  select  without  from ? A surprisingly simple and yet powerful one:  values  without  insert . The following  select  statement can thus be implemented as a standard-conforming values without insert: Instead of a non-conforming  select  without  from : SELECT CURRENT_DATE the standard allows the use of  values  without  insert : VALUES (CURRENT_DATE) Too bad the stand-alone use of  values  is still not part of  Core SQL . Conse