GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  Oracle  >  SQL

 Print  |  
Question:  Select from table without using column name

Answer: How can I select column values from a table without knowing the column name ?
Suppose , select employee_id from employees , now I don't know the column name and I want to select the column.
Please let me know the answer


June 06, 2008 10:02:04 #4
 ramyaselvi16   Member Since: June 2008    Total Comments: 6 

RE: Select from table without using column name
 
we must follow 2 steps.

1. to find out column name using table name.
2. Then we can take corresponding column name from above results.

Ex:
 Select column_name from all_tab_columns where table_name='countries';

The Output will be:
COLUMN_NAME
-------------------------
COUNTRY_ID
COUNTRY_NAME
REGION_ID


Then we wil use column names what u need from above list;

Ex:
 select * from countries where country_id=91;


Rgds

Ramya
     

 

Back To Question