Page 1 of 1

Difference between queries

PostPosted: Sun Nov 07, 2010 12:04 pm
by Shakthivel V
Hi ,


I need to findout difference between 2 queris.

For example:

Query 1 : select * from emp where emp_id=19 returns 10 records

Query2 : select * from dept where dept_id=10 returns 15 records. Both the tables have same records. i need the differnce of 5 records?

Re: Difference between queries

PostPosted: Sun Nov 07, 2010 1:22 pm
by enrico-sorichetti
what kind of question is this :?

select * from emp where emp_id=19 returns 10 records
select * from dept where dept_id=10 returns 15 records


for what reason do You pretend that...
two completely unrelated queries to two completely unrelated tables
should give the same result :shock:

Both the tables have same records. i need the differnce of 5 records?

???

Re: Difference between queries

PostPosted: Sun Nov 07, 2010 10:07 pm
by dick scherrer
Hello,

what kind of question is this
A beginner/student question :)

@Shakthivel V
It is extremely important to use proper terminology as well as clearly state your requirement or doubt. . .

Tables have rows not records.

select * from emp where emp_id=19 returns 10 records
Nearly always emp_id is the key to the table - why are there 10 emp rows with the same id? Is this a complete typo? Is dept_id really what is needed?

Are you trying to understand why the 2 queries return a different number of rows or are you trying to have the query return the value obtained by calculating the difference in the number of rows returned?