Comments - SELECT

11 years, 2 months ago Lubos Dz

Is there any inverse SELECT in MariaDB for selecting all columns but few specified? I found in practice very useful syntax like:

SELECT * EXCEPT (col1, col2) FROM ...

This would select all columns except for those declared within the EXCEPT keyword. This is specially useful for tables with many columns. MySQL does not support anything similar, currently neither does MariaDB as far as I know.

Issue is discussed e.g. here:

http://stackoverflow.com/questions/9122/select-all-columns-except-one-in-mysql

Thanx. Lubos

 
9 years, 2 months ago Daniel Black

It seems equally as bad as select *. There's a number of reasons why select * are bad - http://www.parseerror.com/blog/select-*-is-evil . There are exceptions to this rule (like every rule) but it in generally using select * is a common way to incur a software maintenance debt. It also can force the db to retrieve more data than needed, and in doing, so miss out on query optimisations to get your data quicker (if you don't actually need all columns).

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.