1

Possible Duplicate:
SQL exclude a column using SELECT * [except columnA] FROM tableA?

Hi all

I am using Mysql.

and I am looking for, Is it posssible to use a query to select all coumns except few columns?

Community
  • 1
  • 1
OM The Eternity
  • 14,916
  • 40
  • 117
  • 180

2 Answers2

6

No it is not possible, the expression "select all except" has not yet been implemented in any existing database.

Marino Šimić
  • 7,256
  • 1
  • 27
  • 59
  • 2
    To be more specific on the why: - Select * is a slow expression that requires the database to fetch column definition for the entire table - Select column_list is faster but still requires some computation time - Select * except column_list would be the most inefficient expression requiring processor time like the other two expression together – Marino Šimić Mar 24 '11 at 11:34
2

Yes, by listing the columns specifically, e.g.

select col1, col3, col5, othercol
from tbl

(table contains other columns not listed)

But if your question is about something like (pseudo)

select * - (col2,col4)
from tbl

meaning, * = all, less col2 & col4, then it hasn't been implemented in any DB system to date.

RichardTheKiwi
  • 102,799
  • 24
  • 193
  • 261