SQL Database Assignment
Topic: Student Result Management System
Course Learning Outcomes (CLOs):
• CLO1: Demonstrate use of variables, data types, and output formatting using SQL
commands.
• CLO2: Apply control structures and relational database concepts (DDL, DML, Joins,
Queries, etc.) to solve problems.
Instructions
• This is an individual assignment. Copying or sharing code is not allowed.
• Write SQL queries for each question and take screenshots of the output.
• Submit your work as a Word file with:
• • Your Name
• • Roll Number
• • Screenshots of executed queries
• Be ready to explain your code in class viva.
• File name: YourName_RollNo_SQL_Assignment.docx
Scenario: Student Result Management System
A university wants to maintain records of its students, their departments, and exam results.
You are required to create a database named 'StudentDB' and perform the following tasks.
Q1. (DDL Commands — CLO1)
• Create the following tables with appropriate data types:
• 1. Department: DeptID (Primary Key), DeptName
• 2. Students: StudentID (Primary Key), StudentName, Age, DeptID (Foreign Key
references Department table)
• 3. Results: ResultID (Primary Key), StudentID (Foreign Key references Students table),
Subject, Marks, Grade
Q2. (DML Commands — CLO1)
• Insert at least 4 records in each table using INSERT INTO statements.
Q3. (JOINS — CLO2)
• 1. Display student names with their department names using an INNER JOIN.
• 2. Display each student's name, department name, subject, and marks using multiple
table joins.
Q4. (Aggregate Functions — CLO2)
• 1. Find the average marks of all students.
• 2. Find the highest marks in each subject.
• 3. Count the total number of students in each department.
Q5. (Operators — CLO2)
• 1. Display students who scored more than 80 marks in any subject.
• 2. Display students whose names start with the letter ‘F’.
Q6. (Nested Queries — CLO2)
• Write a nested query to display the name of the student who scored the highest marks
in the subject 'Database'.
Q7. (Stored Procedure — CLO2)
• Create a stored procedure named GetStudentsByDept that accepts a department name
as a parameter and displays:
• • Student name
• • Age
• • Department name
• Execute the procedure for 'Computer Science'.
Q8. (Output & Submission)
• Include screenshots of:
• • Table creation
• • Data insertion
• • Query outputs for each question
• • Execution of stored procedure
Plagiarism Policy
• Copying SQL code or results from classmates or the internet is strictly prohibited.
• Submissions with more than 20% similarity will result in zero marks.
• Viva questions will verify your understanding.