Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 query help

Author  Topic 

snowday
Starting Member

2 Posts

Posted - 2011-02-02 : 11:36:22
hi,

2 tables

country
cntry_id NUMBER(9), -- primary key
cntry_name NVARCHAR(40),
….

manager
cntry_id NUMBER(9),
manager_id NUMBER(9)

Each manager has unique manager id and can belong to one or more country. The manager that belongs only to country name “usa” and not any other country is SUPER MANAGER and have full rights. The manager that belong to country “usa” and to at least one other country have limited rights. The manager that do not belong to country “usa” have no rights.

question is

1.List of country names that have only manager with no rights.

2.Sorted list of manager's id who has full rights.

3.List of manager's ids who belongs to country name "japan" and have limited rights.

thanks in advance

KenW
Constraint Violating Yak Guru

391 Posts

Posted - 2011-02-02 : 12:30:56
quote:
Originally posted by snowday


question is

1.List of country names that have only manager with no rights.

2.Sorted list of manager's id who has full rights.

3.List of manager's ids who belongs to country name "japan" and have limited rights.



If we do your homework for you, you won't learn anything.

Please post what you've tried and explain why you think it didn't work. Then someone here can help you figure out why it didn't work, and you'll actually learn something in the process. :-)
Go to Top of Page

snowday
Starting Member

2 Posts

Posted - 2011-02-02 : 13:21:57
Hi, thanks,

I tried for 1st question like below but gave me all manager_id, not only manager from country usa.


SELECT c.manager_id FROM country c, manager m WHERE c.country_id=m.country_id
AND c.country_name NOT IN ('usa')

please suggest


quote:
Originally posted by KenW

quote:
Originally posted by snowday


question is

1.List of country names that have only manager with no rights.

2.Sorted list of manager's id who has full rights.

3.List of manager's ids who belongs to country name "japan" and have limited rights.



If we do your homework for you, you won't learn anything.

Please post what you've tried and explain why you think it didn't work. Then someone here can help you figure out why it didn't work, and you'll actually learn something in the process. :-)

Go to Top of Page
   

- Advertisement -