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

Questions by sanjoy.dubey   answers by sanjoy.dubey

Showing Answers 1 - 20 of 20 Answers

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

navkmh

  • Aug 27th, 2008
 

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

  Was this answer useful?  Yes

We can select from table without using column name.
We can select form table according to sequence of column, but only sequentially we can do this thing.

For ex: Select 1, 2 from table;
This query will give the result of those column which are in this sequence.

SELECT * FROM <TableName>;
This query will show the all records of that table.
Otherwise 1st:
DESCRIBE <TableName>;
This will show the table design.
Then 2nd:
SELECT <SelectedColumnName> FROM <TableName>;

  Was this answer useful?  Yes

dj_dj_dj

  • Jun 8th, 2009
 

If you do not know the column name you want to select from the table, I would simply suggest you that, follow this command:


SELECT * FROM table_name


here * let you choose all the column name from the respective table.

  Was this answer useful?  Yes

Geoffry

  • Apr 23rd, 2013
 

You can Apply This.

Select * from tablename where signin value("serverhost" "root" "viky")
$email[eml]
$pass[pass]
iffisset[login value-submit]

  Was this answer useful?  Yes

AZHAR

  • Jun 27th, 2013
 

SELECT &COL
FROM ODS_PRODUCT_DIM

IF YOU RUN THE ABOVE QUERY IT WILL PROMPT YOU FOR THE COLUMN NAME FROM SPECIFIC TABLE.

THIS WORKS

Code
  1. SELECT &COL

  2. FROM ODS_PRODUCT_DIM

  Was this answer useful?  Yes

Hi Sanjoy,
Its a simple logic that, one should have complete idea about the Table , Table fields and data types used.. before applying any DML DCL DDL Commands, a programmer shoud know this. A programmer sholud have minimum knowledge on the Table from where he is pulling data.

From the question :

Its is not considered as a valid question.. but you can get the columns names the Table having
1) Select * from Table_name : Where you get the column name
2) desc Table_name : Here you will get complete description of the column names
3) Press F4 on Table Name (Toad) : You will get the column names of the Table
4) all_tab_columns : In this you get the table name and columns containing in it
Only from the above case you will get column name.. You cant predict or enough lucky that you will get column name what you looking for.

  Was this answer useful?  Yes

suganthi

  • Jul 2nd, 2015
 

How to display data from table values without using select command?

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions