Reputation: 831
Let's assume I have a table named Alphabet. Now let's say this table has the following columns:
a, b, c, d, e ..., z
Now I want to select everything from the mentioned table (but select f as aaa), but I don't want to do this:
select a, b, c, d, e, f as aaa, g ..., z
from Alphabet;
Clearly the above is cumbersome if the are a lot of columns. So I am thinking if it is possible to do something like
select f as aaa, *
from Alphabet;
This is probably something there is a lot info about on the net, but I'm not sure what to search for. Has this kind of select got an expression or name? Thanks in advance
Upvotes: 19
Views: 14547
Reputation: 1269493
You can write this:
select a.f as aaa, a.*
from Alphabet a;
Note that the output set will contain both f
and aaa
. It is unclear whether this is what you want.
To remove f
from the result set, you need to list all the columns that you do want.
Upvotes: 30