Anda di halaman 1dari 3

1) select * from role inner join user on role.id=user.role_id order by role.

name
,user.name;
2) select * from role left join user on role.id=user.role_id order by role.name,
user.name;
3) select user.name,role.name from user inner join role on user.role_id=role.id
order by user.name;
4) select user.phonenumber, user.emailid, profile.batch, department.name, profil
e.designation, experience.company_name
from user inner join profile on user.profile_id=profile.id inner join degree on
profile.degree_id=degree.id inner join department on
degree.department_id=department.id inner join experience on experience.profile_i
d=profile.id where user.name="Ram" and experience.current=1;
5) select user.name, skill.name from user inner join profile_skills on user.prof
ile_id=profile_skills.profile_id
inner join skill on profile_skills.skill_id=skill.id inner join role on user.rol
e_id=role.id where role.name="Alumni" order by user.name,skill.name;
6) select user.name, experience.company_name from user inner join profile on use
r.profile_id=profile.id inner join experience on profile.id=experience.profile_i
d inner join role on user.role_id=role.id where role.name="Alumni" order by user
.name,experience.company_name;
7) select user.name,experience.company_name from user
left join role
on user.role_id=role.id
left join profile
on user.profile_id=profile.id
left join experience
on profile.id=experience.profile_id
where role.name='Alumni'
order by user.name,experience.company_name;
8. select user.name, experience.company_name from user inner join profile on use
r.profile_id=profile.id inner join experience
on profile.id=experience.profile_id inner join role on user.role_id=role.id wher
e role.name="Alumni" and experience.current=1
order by user.name,experience.company_name;
9. select user.name, experience.company_name from user inner join profile on use
r.profile_id=profile.id inner join experience
on profile.id=experience.profile_id inner join role on user.role_id=role.id wher
e role.name="Alumni" and experience.current=1
and profile.batch="2008" order by user.name,experience.company_name;
10. select user.name, user.emailid, user.phonenumber, profile.address from user
inner join profile on user.profile_id=profile.id
inner join role on user.role_id=role.id where role.name="Alumni" order by user.n
ame;
11. select
inner join
inner join
ch ="2008"

user.name, user.emailid, user.phonenumber, profile.address from user


profile on user.profile_id=profile.id
role on user.role_id=role.id where role.name="Alumni" and profile.bat
order by user.name;

12. select user.name, user.emailid, user.phonenumber, profile.address from user


inner join profile on user.profile_id=profile.id
inner join degree on profile.degree_id=degree.id inner join role on user.role_id
=role.id where role.name="Alumni" and degree.name="BSC_CT"
order by user.name;

13. select user.name, user.emailid, user.phonenumber, profile.address from user


inner join profile on user.profile_id=profile.id
inner join degree on profile.degree_id=degree.id inner join department on degree
.department_id=department.id inner join
role on user.role_id=role.id where role.name="Alumni" and department.name="CSE"
order by user.name;
14)select user.name,higher_degree.university_name from user
inner join role
on user.role_id=role.id
inner join profile
on user.profile_id=profile.id
inner join higher_degree
on profile.id=higher_degree.profile_id
where role.name='Alumni' and higher_degree.degree_name is not null
group by user.name,higher_degree.university_name ;
15)select user.name,higher_degree.university_name from user
inner join role
on user.role_id=role.id
inner join profile
on user.profile_id=profile.id
inner join higher_degree
on profile.id=higher_degree.profile_id
inner join degree
on profile.degree_id=degree.id
join department
on degree.department_id=department.id
where role.name='Alumni' and department.name='CSE' and higher_degree.degree_name
is not null
group by user.name,higher_degree.university_name ;
16. select user.name, user.emailid, user.phonenumber, profile.address from user
inner join profile on user.profile_id=profile.id
inner join higher_degree on profile.id=higher_degree.profile_id inner join role
on user.role_id=role.id where role.name="Alumni" and
higher_degree.university_name="Texas University" order by user.name;
17. select user.name, profile.batch from user inner join profile on user.profile
_id=profile.id inner join role on user.role_id=role.id
where role.name ="Alumni" and profile.gender="female" order by user.name;
18. select user.name, profile.batch, degree.name from user inner join profile on
user.profile_id=profile.id
inner join degree on profile.degree_id=degree.id inner join role on user.role_id
=role.id where role.name ="Alumni" and profile.gender="female"
order by user.name;
19. select user.name, profile.batch, degree.name, department.name from user inne
r join profile on user.profile_id=profile.id
inner join degree on profile.degree_id=degree.id inner join department on degree
.department_id=department.id inner join
role on user.role_id=role.id where role.name ="Alumni" and profile.gender="femal
e" order by user.name;
20. select degree.name, department.name from degree inner join department on deg
ree.department_id=department.id order by degree.name;

21. select user.name, profile.designation from user inner join profile on user.p
rofile_id=profile.id inner join role on user.role_id=role.id
where role.name="Alumni" and profile.gender="male" order by user.name;
22. select user.name, profile.designation from user inner join profile on user.p
rofile_id=profile.id inner join role on user.role_id=role.id
inner join experience on experience.profile_id=profile.id where role.name="Alumn
i" and experience.company_name="TCS" and experience.current=1
order by user.name;
23)select user.name,query.content from user
inner join query
on user.id=query.user_id
order by name,date(date);
24)select user.name,query.content from user
inner join query
on user.id=query.user_id
where parent_id is not null
order by name,date(date);
25. select user.name, post.content from user inner join post on user.id=post.use
r_id order by user.name,post.date;
26) select user.name,post.content from user
inner join post
on user.id=post.user_id
inner join post_type
on post.type_id=post_type.id
where post_type.name='Technology'
order by user.name,post.date;
27. select user.name, post.content from user inner join post on user.id=post.use
r_id
where post.date >="2013-01-01" and post.date <="2013-12-31" order by user.name,
post.date, post.content;
28. select user.name, department.name from user inner join profile on user.profi
le_id=profile.id inner join degree on profile.degree_id=degree.id
inner join department on degree.department_id=department.id inner join profile_s
kills on profile_skills.profile_id=profile.id inner join
skill on profile_skills.skill_id=skill.id where skill.name="programming" order b
y user.name;
29. select user.name, event.name from user inner join event on user.id=event.org
aniser_id order by user.name, event.date;
30. select user.name, event.name from user inner join event on user.id=event.org
aniser_id inner join role on user.role_id=role.id
where role.name="Alumni" order by user.name, event.date;