4
In Mysql, when we will make a SELECT
, generally we can specify each field we want to return.
SELECT id, nome FROM usuarios
But let’s imagine a scenario where I have 50 columns in a table and I didn’t want the fields to be displayed senha
and email
.
It would be easier, logically, I specify that I don’t want these 2 fields, than selecting the others 48 fields remaining that I want to be shown
Is there any way to do this in Mysql?
+1 by DRY(dont repeat yourself) of the second item applied in the creation of the
view
. For we would have a definition in one place only that would be used in several other places :)– Wallace Maxters
On second thought, why is there not yet a simple solution (such as
NOT SELECT <column>, <column> FROM <table>
) in SQL ANSI?– ptkato
It could even exist but is probably little used, rarely makes sense and can bring some obscure problems. I think it’s hardly the intention. Until you say you want everything is common, the
*
was made for this, it clearly says that you want up the columns that you do not know if it exists. To say that you want everything, even what may have been added after less such columns is quite rare to be necessary. Filtering one or the other column can cost more than getting them all, so it better be more explicit than you want.– Maniero