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
Go To First  |  Previous Question  |  Next Question 
 SQL  |  Question 164 of 168    Print  
Select from table without using column name
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



  
Total Answers and Comments: 9 Last Update: September 01, 2008     Asked by: sanjoy.dubey 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
June 13, 2008 00:09:16   #1  
jiteshbiswas Member Since: June 2008   Contribution: 1    

RE: Select from table without using column name
select * from tableName
 
Is this answer useful? Yes | No
June 13, 2008 06:13:10   #2  
imran4108_4u Member Since: June 2008   Contribution: 3    

RE: Select from table without using column name
select * from tablename
 
Is this answer useful? Yes | No
June 16, 2008 02:25:07   #3  
checkout_rajesh Member Since: June 2008   Contribution: 1    

RE: Select from table without using column name
desc tablename; will show all column description
select * from tablename;

 
Is this answer useful? Yes | No
June 23, 2008 10:02:04   #4  
ramyaselvi16 Member Since: June 2008   Contribution: 15    

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

 
Is this answer useful? Yes | No
June 24, 2008 08:14:28   #5  
ramlalaGadai Member Since: February 2007   Contribution: 1    

RE: Select from table without using column name
I think we can also use the index of a column to select a cloumn without using the name.
 
Is this answer useful? Yes | No
June 24, 2008 12:04:41   #6  
srividhya_85 Member Since: June 2008   Contribution: 6    

RE: Select from table without using column name

To Know Column_Name from the table

Select COLUMN_NAME
from USER_TAB_COLUMNS
Where TABLE_NAME = 'EMPLOYEES';


 
Is this answer useful? Yes | No
July 11, 2008 05:45:19   #7  
krishnaveni_g Member Since: July 2008   Contribution: 9    

RE: Select from table without using column name
You describe the table it will show all the columns in the table

Ex: Describe Employees;

 
Is this answer useful? Yes | No
August 27, 2008 03:18:41   #8  
navkmh Member Since: August 2008   Contribution: 1    

RE: Select from table without using column name
I have been using this sql query for selecting the column names of a table.
select column_name from information_schema.columns where table_name='tablename'

Hope u find it useful.

-Naveen

 
Is this answer useful? Yes | No
September 01, 2008 04:41:48   #9  
raghuprasad Member Since: August 2007   Contribution: 21    

RE: Select from table without using column name
We can not select a particular column values without knowing it's name.

However, we can select all the columns from a table using the following statement.

SELECT * FROM table_name;

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape