Anda di halaman 1dari 2

Create STUDENT and MARKS with the following structures. Student(grno(PK),name,address,city,phone_no,adm_date) Marks(grno(FK),sem(fK),m1,m2,m3,tot) Semester(sem(PK),class) Define Constraints Wherever necessary.

Solve the following queries. 1) Display student details with their marks. Select s.*,m.* from Student s, Marks m Where s.Grno=m.grno 2) Display semester wise marks of student. Select * From Marks order by sem 3) Find out maximum,minimum marks of each subject. Select min(m1) as minsub1,min(m2) as minsub2,min(m3) as minsub3, max(m1) as maxM1,max(m2) as maxM2,max(m3) as maxM3 from marks 4) Find out total, percentage of all students. Update marks set total=m1+m2+m3,per=(m1+m2+m3)/3 or Select m.Grno,m.m1,m.m2,m.m3,m.m1+m.m2+m.m3 as Total,(m.m1+m.m2+m.m3)/3 as Per From marks m 5) Display student details who have passed in all subjects. Select s.*,m.* from Student s, Marks m Where s.grno=m.grno and m1>=35 and m2>=35 and m3>=35 6) Display student details who have passed in any two subjects. Select s.*,m.* from Student s, Marks m Where s.grno=m.grno and (m1>=35 or m2>=35) and (m2>=35 or m3>=35) and (m1>=35 or m3>=35) 7) Display the name of the student who have secured 1st rank. Select top 1 s.name from student s, marks m where s.grno=m.grno order by m.per desc 8) Display the name of the student who have secured maximum marks in m1. Select top 1 s.name from student s, marks m where s.grno=m.grno order by m.m1 desc

9) Display all student details who have taken admission in june. Select * from Student Where Format(adm_date,'mmm')='jun' 10) Display all students marks of TYBCA who have passed FYBCA from the same coll ege. 11) Display FYBCA student details, SYBCA student details. Select s.* from student s, marks m, semester s1 where s.grno=m.grno and m.sem=s1.sem and class in('fybca','sybca' ) 12) Change the class FYBCA to 1YEAR, SYBCA to 2YEAR and TYBCA to 3YEAR. update semester set class='1YEAR' where class='fybca' update semester set class='2YEAR' where class='sybca' update semester set class='3YEAR' where class='tybca' 13) Display merit list of FYBCA student. select s.name,m.per from student s, marks m, semester s1 where s.grno=m.grno and m.sem=s1.sem and class='1Year' order by m.per desc 14) Display all student details who have taken admission in 2007. Select * from Student Where year(adm_date)=2007 or Select * from Student Where Format(adm_date,'yyyy')=2007

Anda mungkin juga menyukai