Exp3 DBMS Lab
Exp3 DBMS Lab
ROLL NO: 14
BRANCH: BTECH
SECTION: CF (CSF)
YEAR: 1st
SEMESTER: 2nd
4. IDs, name, GPA of students and name of college with GPA >3.7
applying to Stanford.
mysql> select student.sid, student.sname, student.gpa,
apply.cname from student join apply on student.sid = apply.sid join
college on apply.cname = college.cname where college.cname =
'Stanford' and student.gpa > 3.7;
5. Find detail of student who apply to CS major and their application
are rejected.
mysql> select s.sid as student_id, s.sname as student_name, s.gpa,
a.cname as college_name, a.major, a.decision from student s inner
join apply a on s.sid = a.sid where a.major = 'CS' and a.decision =
'N';
10. Find name and GPA of applicants who apply to any college
whose enrollment is not more than 25000.
mysql> select s.sname as student_name, s.gpa from student s inner
join apply a on s.sid = a.sid inner join college c on a.cname =
c.cname where c.enrollment <= 25000;
11. Find pair of students (sID) having same GPA. (each pair should
occur just once in result) 4
mysql> select distinct s1.sid as student1_id, s2.sid as student2_id
from student s1 inner join student s2 on s1.sid < s2.sid and s1.gpa =
s2.gpa;