
- Forum
- Database
- Oracle Database
- Oracle queries
Oracle queries
This is a discussion on Oracle queries within the Oracle Database forums, part of the Database category; Dear friends i am in trouble can u plzzzz help me .i have 2 questions plz sove it 1- i ...
-
01-02-2007, 05:02 AM #1
- Join Date
- Jan 2007
- Answers
- 1
Oracle queries
Dear friends
i am in trouble can u plzzzz help me .i have 2 questions plz sove it
1- i have to use if condition with select statement
2-make such type of query so that it deletes duplicate data in a table
Thanx
Ashish Pandey
-
01-16-2007, 01:18 PM #2
- Join Date
- Jan 2007
- Answers
- 1
Answer for second question
To eleminate duplicate rows use this one and try it.
select distinct job from emp;
useing decode function we can implement the if condition in select statement.i don't know exact quary i will send tomarrow.
-
01-20-2007, 12:44 PM #3
- Join Date
- Jan 2007
- Answers
- 2
hello friend
for deleting duplicate values in table use following query
delete * from table_name
where row_id < (select max(row_id) from table_name
group by column_name);
this query wll delete the duplicates rows
-
Ashish did you try the suggestions given by our friends here in this thread. What is the result? Is your problem solved? Let us know so that we could know your status of query
-
05-10-2007, 11:14 PM #5
- Join Date
- Apr 2007
- Answers
- 2
Let me know if it works in deleting duplicate rows.
1. In order to user it in if statement you have to make procedure,or cursor
then use this syntax in then condition.
delete from table_name where rowid not in (select max(rowid)
from table_name group by column_name); (not null column).
-
06-25-2007, 05:24 AM #6
- Join Date
- Jun 2007
- Answers
- 8
Delete duplicate rows and decode function in SQL query
we can delete the duplicate records from the table using with the below querys
delete ename from emp a where rowid < (select min(rowid) from emp b
where a.rowid<=b.rowid);
Decode function:
we can select the employee based on the sex(male (M) and Female(F) using decode function
select decode(M,'Male',1,
decode (F,'Female,0) from emp;
Syntax for decode like if...than...else
IF s = search1
THEN result1
ELSE default
Exercises
Regards,
Siva.P
Bangalore
-
10-22-2011, 03:29 AM #7
both are same but when u r in learning stage use select statement with DISTINCT keyword
-
Sponsored Ads

Reply With Quote





