GeekInterview.com
Answered Questions

Select from table without using column name

Asked By: sanjoy.dubey | Asked On: Jun 12th, 2008

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

Answered by: Geoffry on: Apr 23rd, 2013

You can Apply This.

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

Answered by: NSingh on: Sep 27th, 2010

1. Describe tablename
2. Desc tablename
3. select * from tablename

Find sequence max value

Asked By: pc_mts | Asked On: May 9th, 2008

How to find the max value in a sequence?

Answered by: mstreete on: Sep 29th, 2008

If you don't own the sequence, you may look at all_sequences, which shows sequences in other schemas that you have access to:select max_valuefrom sys.all_sequenceswhere sequence_owner = '&sequence_owner' and sequence_name = '&sequence_name'

Answered by: nandk.sharma on: Jun 30th, 2008

We can get the MAX value of a sequence by using the data dictionary view

'USER_SEQUENCES' .


i.e.  SELECT MAX_VALUE FROM USER_SEQUENCES
       WHERE SEQUENCE_NAME='NAME_OF_SEQUENCE'

Hi,select * from tab; - means we can see all the tables,right!Is there any option similar to this..?

Asked By: developer | Asked On: Sep 12th, 2006

Answered by: srividhya_85 on: Jun 24th, 2008

Select distinct TABLE_NAME
from user_tab_columns;

Answered by: krishnaindia2007 on: Jun 22nd, 2008

Synonym name  Synonym for Table CAT USER_CATALOG CLU USER_CLUSTERS DICT DICTIONARY IND USER_INDEXES ...

How to delete duplicate values from tablefor ex: a table contains 200 rows in that 100 rows are duplicate values, how to delete those 100 rows?

Asked By: mangaiah | Asked On: Apr 1st, 2006

Answered by: gcvpgeek on: Mar 16th, 2009

Use this simple query

delete from table1 where rowid not in (select max(rowid) from table1 group by duplicate_col_name)

Answered by: srividhya_85 on: Jul 5th, 2008

Hi,   'X' refers here to the table name and 'a' and 'b' are the alias nameDelete from X a where rowid in (select min(rowid) from X  b  &...

A table has following layout ; city, name , sexhow do you write a query to get the count of male, count of female in a given city xxx.Query result should be in a single row with count of male , count of...

Asked By: shireen | Asked On: Mar 16th, 2006

Answered by: rajayoghi on: Jan 6th, 2010

select count(case when sex='male' then 1 end) "male", count(case when sex='female' then 1 end)"male", city from cnt where city = 'bangalore';

Answered by: ashishkumar2403 on: Jan 2nd, 2010

SELECT city,DECODE(sex,'M',COUNT(sex),null)male, DECODE(sex,'F',count(sex),null)female FROM test GROUP BY city,sex;

This will give the name of city along with corresponding number of male and female on that city.

In SQL. (db2)there is one dept table and other emp tablequestion- select emp name from emp whose dept no. Is not in dept table and it is present in emp table plz tell the query?

Asked By: dinesh | Asked On: Oct 22nd, 2005

Answered by: jayshree13 on: May 13th, 2011

select e.ename,e.deptno,d.deptno from emp e,dept d where e.deptno=d.deptno(+);

Answered by: srividhya_85 on: Aug 5th, 2008

Select emp_name from emp awhere not exists(select 1                         ...

Interview Question

 Ask Interview Question?

 

Career Counselling

 Have Career Question?

 Ask Chandra

 Ask Only Career questions.

Follow us: