By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,377 Members | 1,279 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,377 IT Pros & Developers. It's quick & easy.

Probs In Query

P: 95
TABLE FIRST
Create table student1(roll int,marks int)
insert into student1 values(1,10)
insert into student1 values(2,20)
insert into student1 values(3,30)


TABLE SECOND
create table info(roll int,addr varchar(10))
insert into info values(1,'Delhi')
insert into info values(2,'Fbd')
insert into info values(4,'Gurgaon')


1)select info.roll from info ,student1 where info.roll=student1.roll
ANSWER IS RIGHT
1
2

2)select info.roll from info ,student1 where info.roll <> student1.roll
ANSWER is supposed to be Only Roll No 4.
But the result is coming out Different......
Mar 19 '08 #1
Share this Question
Share on Google+
1 Reply


ck9663
Expert 2.5K+
P: 2,878
TABLE FIRST
Create table student1(roll int,marks int)
insert into student1 values(1,10)
insert into student1 values(2,20)
insert into student1 values(3,30)


TABLE SECOND
create table info(roll int,addr varchar(10))
insert into info values(1,'Delhi')
insert into info values(2,'Fbd')
insert into info values(4,'Gurgaon')


1)select info.roll from info ,student1 where info.roll=student1.roll
ANSWER IS RIGHT
1
2

2)select info.roll from info ,student1 where info.roll <> student1.roll
ANSWER is supposed to be Only Roll No 4.
But the result is coming out Different......
Try WHERE NOT EXISTS or WHERE NOT IN

-- CK
Mar 19 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.