SQL 1 (12th)
SQL 1 (12th)
Q1. Define a Relational Data Model. Explain the terms Relation, Attribute, Tuple, and Domain. (4 Marks)
Q2. Differentiate between Primary Key and Foreign Key. Provide an example for each. (3 Marks)
Q3. Explain any three SQL constraints. Provide examples to demonstrate their use. (3 Marks)
Q4. Explain the following SQL commands with syntax and examples: (5 Marks)
a. ALTER TABLE (to add/remove attributes)
b. GROUP BY with HAVING clause
Section B: SQL Queries (12 Marks)
Q5. Consider the following table Students:
RollNo Name Age Marks
1 Aman 18 85
2 Bhavya 19 90
3 Charu 18 75
4 Divya 17 80
Write SQL queries for the following:
a. Retrieve names of students who scored more than 80 marks. (1 Mark)
b. Display the student details sorted by Age in ascending order. (1 Mark)
c. Find the average marks of students. (1 Mark)
d. Update the Marks of Bhavya to 95. (1 Mark)
Q6. Write the SQL query to create a table named Employees with the following structure:
EmpID (integer, primary key)
Name (varchar(50), not null)
Salary (float)
Department (varchar(20))
(2 Marks)
Q7. Using the table Employees, write SQL commands to:
a. Insert a record with values (101, 'Raj', 55000, 'HR').
b. Delete the record of an employee with EmpID = 101.
(2 Marks)
Q8. Explain the difference between IS NULL and IS NOT NULL with examples. (2 Marks)
Section C: Python-SQL Interface (8 Marks)
Q9. Write a Python script to connect to an SQL database named School and create a table Subjects with
columns: SubID (integer, primary key), SubName (varchar(30)). (4 Marks)
Q10. Explain the following Python-SQL methods:
a. execute()
b. fetchall()
c. commit()
d. rowcount
(4 Marks)
Answer Key: Grade 12 Periodic Test 1 (35 Marks)