tags:

views:

72

answers:

2

hi in my database i am store more than 50 field with primarykey (Auto increment) i am not sure about the fields name but i wants to select the entire data in that table , i am using

SELECT * FROM tablename

i want to select all the fields except that ID but this query populate the entire table so is there is possible to unselect the particular field in the select query. Can anyone have an idea please guide me. Thanks in Advance

+1  A: 

The * indicates that you want to select ALL fields from a given table. If you want to select only a few fields, or all but one, then you will need to specify the ones you want manually:

select field1,field2,field3 from tablename
Cetra
yes i know but i am not have that field names then how can i specify the field my table contain more than 50 columns it is not possible type all 50 column names
raam
Why isn't it possible exactly? Because it's too much effort? I'm sorry I couldn't give you the answer you wanted.
Cetra
A: 

The SQL standard does not offer an "except" notation. It would be neat if we could

select t.* -t.ID
from some_table t
/  

but it is not supported.

On the other hand, SELECT * is a dangerous construct. It is always better to explicitly list the columns we want in any given situation.

APC