SELECT (MySQL)
Versie door Jeroen Strompf (overleg | bijdragen) op 12 dec 2022 om 07:25
SELECT is such an ubiquitous statement in SQL, that it seems overkill to write even an article about it. However, occasionally I do come across new or suprising aspect of this command:
Multiple columns in a direct statement
A statement like
select concat ("This ", "are ", "four ", "statements");
can also be done like this:
mysql> select "This", "are", "four", "columns"; +------+-----+------+---------+ | This | are | four | columns | +------+-----+------+---------+ | This | are | four | columns | +------+-----+------+---------+ 1 row in set (0,00 sec)
or even:
mysql> select "This" as c1, "are" as c2, "four" as c3, "columns" as c4; +------+-----+------+---------+ | c1 | c2 | c3 | c4 | +------+-----+------+---------+ | This | are | four | columns | +------+-----+------+---------+ 1 row in set (0,00 sec)