Database Administration and Object-Oriented Programming CA
Database Administration and Object-Oriented Programming CA
Programming
Total Marks: 100
Duration: 2 Hours
SECTION A: Database Administration (50 Marks)
Task 1: Create a Database (2 Marks)
• Create a new database named SchoolManagement.
Task 2: Create Tables (25 Marks)
• Create the following two tables with specified attributes and constraints:
1. Students
• StudentID (Primary Key, Integer, Not Null)
• StudentName (Varchar(100), Not Null)
• Age (Integer, Not Null)
• ClassID (Integer, Foreign Key, Not Null)
2. Classes
• ClassID (Primary Key, Integer, Not Null)
• ClassName (Varchar(100), Not Null)
• RoomNumber (Varchar(10))
• Establish a relationship between Students and Classes using ClassID as a
foreign key.
Task 3: Populate Tables with Data (10 Marks)
• Insert the first 10 records into each table, ensuring that the data is consistent with
the foreign key constraints.
Task 4: Queries (13 Marks)
• Write and execute the following SQL queries:
1. Retrieve all students who are older than 12 years.
2. List the class name and room number along with the names of all students
in each class.
3. Find the class with the most students and display the class name and the
number of students.
Classes Table Data
1 Mathematics 101A
2 English 102B
3 History 103C
4 Science 104D
6 Art 106F
7 Music 107G
8 Computing 108H
9 Geography 109I
10 Literature 110J
Students Table Data
1 Alice Johnson 14 1
2 Bob Smith 13 2
3 Charlie Daniels 15 3
4 David Wilson 12 4
5 Emily Thompson 14 5
6 Fiona Graham 13 6
7 George King 15 7
8 Hannah Lee 12 8
9 Ian Morris 14 9
10 Jane Perry 13 10
11 Kyle Ray 12 1
12 Laura Newman 14 2
Instructions:
• Write clear and executable SQL commands and code.
• Comment your code to explain your logic where necessary.
• Ensure your solutions are efficient and adhere to standard practices.