Can we exclude a column on select * query!

Can we exclude some field while we do the query like select * from
tabl… where…

basically what i need is like this…

select * from tabl ( exclude id field which is primary and AI ) where id=5;

is it possible in mysql?

OR

how to create a query to select all columns except AI column, without quoting all column names in query.

Thx

The only way of doing it is by specifying all of the columns by name apart from the one you want to select.

If you do use select *, you can then just ignore the column you don’t want when you process the data.

You shouldn’t really use select * in your code at all as that will mean that the code needs rewriting if you ever need to change the fields in the table. You really ought to list the fields you actually need so that the code will not be affected by adding or deleting any of the other fields in the table that this particular call doesn’t need to reference.

not very good advice

what if the column not needed is a BLOB?

Please explain little more with sql, how can we use ignore on particular cases though some restrictions are there as posted by r937

How ignore works in sql in simple definition please!

ignoring a column in a result set works like this:

:smiley: :smiley:

Hey, i think i am more ignored rather than use of ignore in sql.
:confused:

Answer is already given in post #4 by felgall :slight_smile:

there is no “ignore” in sql

if you want all columns of a table except one, you must list the columns you want

in other words, this –

how to create a query to select all columns except AI column, without quoting all column names in query
is not possible – you must list the columns you want