Documente Academic
Documente Profesional
Documente Cultură
ASSIGNMENT
Name- Shreya
Roll No- 17001
Class- BMS 1A
Question1
To computerize the library system of a college.
Solution:
Create table librarybooks17001 (accessionnumber int primary key not null, title Varchar(10), Author
varchar(20), Department varchar(15), Price int, PurchaseDate date,);
Inserting values
Create table issuedbooks17001 (accessionnumber int primary key not null, Borrower varchar(20),
foreign key(accessionnumber) references librarybooks17001(accessionnumber));
Inserting values:
QUESTION 2
StudentInfo( Roll no, Name of Student, Date of Birth, Address, Marks, Phone Number)
Solution:
Create table Studentinfo_17001 (Rollno int primary key not null, Name varchar(15), DOB, Address
varchar(30), Phoneno int);
Inserting data into StudentInfo_17001:
Create table Paperdetails_17001 (papercode int primary key not null, nameofpaper varchar(15));
Inserting values into PaperDetails_17001:
a) Design a query that will return the records (from the second table) along with the name of
student from the first table, related to students who have more than 75% attendance and
more than 60% marks in paper 2.
select a.rollno, name, a.papercode from studentinfo_17001 s, academicdetails_17001
a, paperdetails_17001 p where s.rollno=a.rollno AND p.papercode=a.papercode AND
a.papercode=2 AND marksinhomeexam>60 AND attendance>75;
b) List all the students who live in Delhi and have marks greater than 60 in paper 1.
Select Name from studentinfo_17001 s, academicdetails_17001 a where s.Rollno=a.Rollno AND
address like '%delhi%' AND marksinhomeexam>60 AND papercode=1;
c) Find the total attendance and total marks obtained by each student.
Select name, sum(Attendance), sum(marksinhomeexam) from studentinfo_17001 s,
academicdetails_17001 a where s.rollno=a.rollno group by name;
d) List the name of student who has got highest marks in paper 1.
select name from studentinfo_17001 s, academicdetails_17001 a where s.RollNo=a.RollNo AND
Papercode=2 AND marksinhomeexam=(Select max(marksinhomeexam) from
Academicdetails_17001 where Papercode=1);