Corno
Corno

Reputation: 5406

introducing records on the fly in mysql

Is it possible in MySQL to create records on the fly without first having to create a temporary table and then populate it?

I'm thinking about something like this (syntactically incorrect) example:

SELECT * FROM (`id`, `value`) VALUES
(1, "FOO"),
(2, "BAR");

Upvotes: 1

Views: 62

Answers (1)

Devart
Devart

Reputation: 122032

Yes, you can do it this way -

SELECT 1 id, 'FOO' value
  UNION
SELECT 2 id, 'BAR' value

Upvotes: 1

Related Questions