DBMS_practical
DBMS_practical
Bachelor of Technology
In
Artificial Intelligence and Machine Learning
Submitted By
Session 2024-25
DECLARATION BY THE CANDIDATE
We hereby declare that the work entitled “Schema for College Database” is our work,
conducted under the supervision of Mr. Ramnaresh Sharma (Assistant Professor) & Dr.
Hardev Singh Pal (Assistant Professor), during the session Aug-Dec 2024. The report
submitted by us is a record of bonafide work carried out by me.
We further declare that the work reported in this report has not been submitted and will not be
submitted, either in part or in full, for the award of any other degree or diploma in this institute
or any other institute or university.
--------------------------------
Date: 19.11.2024
Place: Gwalior
This is to certify that the above statement made by the candidates is correct to the best of our
knowledge and belief.
ACKNOWLEDGEMENT
We would like to express our greatest appreciation to all the individuals who have helped and
supported us throughout this report. We are thankful to the whole Centre for Artificial
Intelligence for their ongoing support during the experiments, from initial advice and provision
of contact in the first stages through ongoing advice and encouragement, which led to the final
report.
A special acknowledgement goes to our colleagues who help us in completing the file and by
exchanging interesting ideas to deal with problems and sharing the experience.
We wish to thank the faculty and supporting staff for their undivided support and interest which
inspired us and encouraged us to go my own way without whom we would be unable to
complete my project.
In the end, We want to thank our friends who displayed appreciation for our work and
motivated us to continue our work.
Defining Keywords:
SSID: Unique identifier for Semester Section (Primary Key)
Sem: Semester number
Sec: Section
USN: Unique Student Number
SSID: Semester Section Identifier
Subcode: Subject code
Title: Course title/name
Sem: Semester in which the course is offered
Credits: Number of credits for the course
Test1: Marks scored in the first internal assessment test
Test2: Marks scored in the second internal assessment test
Test3: Marks scored in the third internal assessment test
FinalIA: Final internal assessment marks, often calculated as an aggregate of
Test1, Test2, and Test3.
Creating Quieries
STEP 1:
Creating the table for all the Queries:
STEP 2:
Inserting data into the Tables:
2. Compute the total number of male and female students in each semester
and in each section.
SELECT SS.Sem, SS.Sec, S.Gender, COUNT(*) AS TotalCount
FROM STUDENT S
JOIN CLASS C ON S.USN = C.USN
JOIN SEMSEC SS ON C.SSID = SS.SSID
GROUP BY SS.Sem, SS.Sec, S.Gender
ORDER BY SS.Sem, SS.Sec, S.Gender;
3. Create a view of Test1 marks of student USN ‘0901AM231004’ in all
Courses.
CREATE VIEW Test1MarksView AS
SELECT I.Subcode, C.Title, I.Test1
FROM IAMARKS I
JOIN COURSE C ON I.Subcode = C.Subcode
WHERE I.USN = '0901AM231004';
4. Calculate the FinalIA (average of best two test marks) and update the
corresponding table for all students.
UPDATE IAMARKS
SET FinalIA = (
CASE
WHEN Test1 >= Test2 AND Test1 >= Test3 THEN Test1
WHEN Test2 >= Test1 AND Test2 >= Test3 THEN Test2
ELSE Test3
END +
CASE
WHEN (Test1 <= Test2 AND Test1 >= Test3) OR (Test1 >= Test2 AND Test1 <=
Test3) THEN Test1
WHEN (Test2 <= Test1 AND Test2 >= Test3) OR (Test2 >= Test1 AND Test2 <=
Test3) THEN Test2
ELSE Test3
END
) / 2;
5. Categorize students based on the following criterion:
If FinalIA = 17 to 20 then CAT = ‘Outstanding’
If FinalIA = 12 to 16 then CAT = ‘Average’
If FinalIA< 12 then CAT = ‘Weak’
Give these details only for 8th semester A, B, and C section students.