check whether all the emp numbers are indeed unique.
Answers were Sorted based on User's Feedback
Answer / nagendra
select empno, count(empno)
from emp
group by empno
having count(empno) > 1;
| Is This Answer Correct ? | 22 Yes | 4 No |
Answer / santhi kandasamy
In Oracle,
select empno from emp where empno is not null
group by empno
having count(*) >1;
if the above query does not return any rows then you can
consider, empno having unique values.
| Is This Answer Correct ? | 7 Yes | 0 No |
Answer / eswar
select empno,count(empno)
from emp group by empno having count(empno)>1;
| Is This Answer Correct ? | 1 Yes | 0 No |
in rownum we will use < or <= operators only.
If any one knows this query pls send the answer.
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / biswajit rout
SELECT empno,count(*) FROM emp GROUP BY empno;
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / valli
select rowid from (
select emp_no, rownum() over (emp_no) as Rownum
from emp order_by emp_no,sal
) where rownum > 2
If this query returns no rows then we can say all the emp
numbers are indeed unique.
Regard,
Valli
| Is This Answer Correct ? | 0 Yes | 5 No |
Is sql port 1433 encrypted?
there is A table and B table in A table there 5 rows and in b table there are 2 rows i am firing query select * from a,b what will be the output?
What are the conditions an underlying table must satisfy before a cursor can be used by a positioned update or delete statement? : Transact sql
I have 2 packages A and B. Now package A references Package B and Package B references Package A. How do you compile such inter-dependent objects in PL/SQL
5 Answers Doyensys, Infosys, Metric Stream,
What is a record in pl/sql?
What is an Exception ? What are types of Exception ?
how to delete an existing column in a table? : Sql dba
What is sql character function?
- Types of triggers - View - Dcl - Procedures, packages, functions - Metasolve - Can use Dcl in triggers - package case study - Cursor and its types - triggers schedule - Wrap - Why we are using fetch and for in cursor. difference?
What is an Integrity Constraint?
What does count (*) do in sql?
How do I create a sql script?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)