Some of the site's questions rule that something must (or must not) be printed to the output. My question is, in the case of SQL, what really is the output?
The select
command returns result-sets, which can be a 1x1 array of "string".
The print
command, as defined in a specific implementation (sql server), returns a string to the user.
So select 'Hello world!'
and print 'Hello world!'
are both valid commands that return the same string to the user, albeit in different places.
So, which of these are considered "printing" in terms of golf SE? Could it be both?
alert
,print
, andconsole.log
for JS. \$\endgroup\$print
statement. The closest you have isSELECT 'Hello world!' as ''
(justSELECT 'Hello world!'
works but shows the text twice, once on the column name and once on the content). Or\! echo 'Hello world!';
but that's just calling theecho
statement from the console (stackoverflow.com/a/61375812). \$\endgroup\$--skip-column-names
,-N
Do not write column names in results.”? i.stack.imgur.com/xwPNY.png \$\endgroup\$print
statement. Also, I doubt that people will be running the scripts directly from the console. They will probably have an online environment to try it, or a website with an SQL IDE, where that option doesn't exist. But, if an answer for MySQL specifies it, why not? Maybe should be part of the rules? \$\endgroup\$-t
,--tuples-only
Turn off printing of column names and result row count footers, etc.”, but have to also use “-A
,--no-align
Switches to unaligned output mode.” There your empty alias trick doesn't work. In SQLite there is “-[no]header
Turn headers on or off.” but the no is the default anyway. i.stack.imgur.com/1Hmjn.png \$\endgroup\$