0% found this document useful (0 votes)
19 views4 pages

Untitled Document

Uploaded by

arvindpuri1492
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views4 pages

Untitled Document

Uploaded by

arvindpuri1492
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

LAB- ASSIGNMENT 10

AIM: Design and implementation of Student Information System

FOREIGN KEY (Student_ID) REFERENCES


PART 1 : DATABASE DESIGN Student(Student_ID),
-- Student Table FOREIGN KEY (Course_ID) REFERENCES
CREATE TABLE Student ( Course(Course_ID)
Student_ID INT PRIMARY KEY, );
Name VARCHAR(100) NOT NULL,
Address VARCHAR(255), -- Optional: Attendance Table
Phone VARCHAR(15), CREATE TABLE Attendance (
Email VARCHAR(100) UNIQUE NOT NULL, Attendance_ID INT PRIMARY KEY,
DOB DATE, Student_ID INT,
Enrollment_Year INT NOT NULL Course_ID INT,
); Date DATE NOT NULL,
Status VARCHAR(10) CHECK (Status IN ('Present',
-- Course Table 'Absent')),
CREATE TABLE Course ( FOREIGN KEY (Student_ID) REFERENCES
Course_ID INT PRIMARY KEY, Student(Student_ID),
Course_Name VARCHAR(100) NOT NULL, FOREIGN KEY (Course_ID) REFERENCES
Credits INT CHECK (Credits > 0), Course(Course_ID)
Instructor VARCHAR(100) );
);

-- Enrollment Table
CREATE TABLE Enrollment ( PART 2 : SQL IMPLEMENTATION
Enrollment_ID INT PRIMARY KEY, INSERT INTO Student (Student_ID, Name, Address, Phone,
Student_ID INT, Email, DOB, Enrollment_Year)
Course_ID INT, VALUES
Enrollment_Date DATE NOT NULL, (1, 'Arvind Puri', '12 MG Road, Bengaluru', '9876543210',
FOREIGN KEY (Student_ID) REFERENCES '[email protected]', '2002-05-15', 2020),
Student(Student_ID), (2, 'Anayaka Sharma', '45 Nehru Street, Delhi',
FOREIGN KEY (Course_ID) REFERENCES '9988776655', '[email protected]',
Course(Course_ID), '2001-12-10', 2019),
UNIQUE (Student_ID, Course_ID) (3, 'Rahul Verma', '78 Park Avenue, Jaipur', '8899776655',
); '[email protected]', '2003-08-20', 2021),
(4, 'Sneha Iyer', '23 Anna Salai, Chennai', '9789987766',
-- Grades Table '[email protected]', '2002-03-11', 2020),
CREATE TABLE Grades ( (5, 'Amitabh Nair', '9 Marine Drive, Mumbai', '9123456789',
Grade_ID INT PRIMARY KEY, '[email protected]', '2000-07-25', 2018);
Student_ID INT,
Course_ID INT, INSERT INTO Course (Course_ID, Course_Name, Credits,
Grade CHAR(2) CHECK (Grade IN ('A', 'B', 'C', 'D', 'F')), Instructor)
Exam_Type VARCHAR(50), VALUES
(101, 'Database Management Systems', 4, 'Dr. Meera
Kapoor'),
(102, 'Operating Systems', 3, 'Dr. Rajesh Gupta'),
(103, 'Data Structures and Algorithms', 4, 'Dr. Kavita
Sharma'),
(104, 'Software Engineering', 3, 'Dr. Anil Deshmukh'),
(105, 'Artificial Intelligence', 4, 'Dr. Rekha Nair'); SELECT * FROM Enrollment;

INSERT INTO Enrollment (Enrollment_ID, Student_ID,


Course_ID, Enrollment_Date)
VALUES
(1, 1, 101, '2024-11-08'),
(2, 1, 102, '2024-11-09'),
(3, 2, 101, '2024-11-10'),
(4, 3, 103, '2024-11-11'),
(5, 4, 104, '2024-11-12'),
(6, 5, 105, '2024-11-13'),
(7, 5, 101, '2024-11-14'); SELECT * FROM Grades;

INSERT INTO Grades (Grade_ID, Student_ID, Course_ID,


Grade, Exam_Type)
VALUES
(1, 1, 101, 'A', 'Midterm'),
(2, 1, 102, 'B', 'Final'),
(3, 2, 101, 'A', 'Final'),
(4, 3, 103, 'B', 'Midterm'),
(5, 4, 104, 'C', 'Final'),
(6, 5, 105, 'A', 'Midterm'),
(7, 5, 101, 'B', 'Final'); SELECT * FROM Attendance;

INSERT INTO Attendance (Attendance_ID, Student_ID,


Course_ID, Date, Status)
VALUES
(1, 1, 101, '2024-11-08', 'Present'),
(2, 1, 102, '2024-11-09', 'Absent'),
(3, 2, 101, '2024-11-10', 'Present'),
(4, 3, 103, '2024-11-11', 'Present'),
(5, 4, 104, '2024-11-12', 'Absent'),
(6, 5, 105, '2024-11-13', 'Present'), UPDATE Account
(7, 5, 101, '2024-11-14', 'Present'); SET Balance = Balance + 500.00
WHERE Account_ID = 101;

SELECT * FROM Student; INSERT INTO Transaction (Transaction_ID, Account_ID,


Transaction_Type, Amount, Date)
VALUES (4, 102, 'withdrawal', 300.00, '2024-11-09');

PART 3 : TRANSACTION AND FINE


MANAGEMENT
SELECT * FROM Course;

-- Retrieve grades for 'Arvind Puri':

SELECT c.Course_Name, g.Grade, g.Exam_Type


FROM Grades g
JOIN Course c ON g.Course_ID = c.Course_ID
WHERE g.Student_ID = 1;

-- Track attendance for 'Rahul Verma': FROM Attendance a


JOIN Course c ON a.Course_ID = c.Course_ID
WHERE a.Student_ID = 3;
SELECT a.Date, a.Status, c.Course_Name

-- Generate a performance report for all students:


SELECT s.Name, c.Course_Name, g.Grade, g.Exam_Type
FROM Student s
JOIN Grades g ON s.Student_ID = g.Student_ID
JOIN Course c ON g.Course_ID = c.Course_ID
ORDER BY s.Name, c.Course_Name;

ER DIAGRAM :

You might also like