0% found this document useful (0 votes)
9 views3 pages

CSC PracticeWorksheet SQL

The document contains practice questions for Class 12 Computer Science students at National Public School Whitefield, Bengaluru, for the academic year 2026-2027. It includes multiple sections with varying question formats, covering topics such as MySQL commands, database integrity rules, SQL constraints, and practical SQL statement writing. The questions are designed to assess students' understanding of database concepts and their ability to apply SQL in real-world scenarios.

Uploaded by

ginnyweasley0099
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)
9 views3 pages

CSC PracticeWorksheet SQL

The document contains practice questions for Class 12 Computer Science students at National Public School Whitefield, Bengaluru, for the academic year 2026-2027. It includes multiple sections with varying question formats, covering topics such as MySQL commands, database integrity rules, SQL constraints, and practical SQL statement writing. The questions are designed to assess students' understanding of database concepts and their ability to apply SQL in real-world scenarios.

Uploaded by

ginnyweasley0099
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

NATIONAL PUBLIC SCHOOL WHITEFIELD BENGALURU

CLASS 12- PRACTICE QUESTIONS (2026-2027)


COMPUTER SCIENCE (083)

SECTION A
1 Mark Questions:

1. Which command/commands of MySQL affects the degree of a table?

2. A table EMPLOYEE has a degree of 5 and a cardinality of 50. If 10 new employees are
hired and 1 attribute (Phone Number) is removed, what are the new dimensions?

3. Which of the following function can work with NULL values in a database?
(a) avg() (b) sum() (c) count(*) (d) count()

4. In SQL, name the clause that is used to display the tuples in ascending order of an
attribute.

5. Which of the following commands will remove the entire database from MYSQL?
(a) DELETE DATABASE (c) REMOVE DATABASE
b) DROP DATABASE (d) ALTER DATABASE

6. In which datatype the value stored is padded with spaces to fit the specified length?
(a) DATE (b) VARCHAR (c) FLOAT (d) CHAR

7. If a table which has one Primary key and two alternate keys. How many Candidate
keys will this table have?
(a) 1 (b) 2 (c) 3 (d) 4

8. Which of the following statements is FALSE about keys in a relational database?


(a) Any candidate key is eligible to become a primary key.
(b) A primary key uniquely identifies the tuples in a relation.
(c) A candidate key that is not a primary key is a foreign key.
(d) A foreign key is an attribute whose value is derived from the primary key of
another relation.

Q9 is ASSERTION AND REASONING based questions. Mark the correct choice as


a) Both A and R are true and R is the correct explanation for A
b) Both A and R are true and R is not the correct explanation for A
c) A is True but R is False
d) A is false but R is True

9. Assertion (A): In SQL, the WHERE clause can be used with DELETE, UPDATE, and
SELECT statements.
Reason (R): The WHERE clause is mandatory in these statements.

1
SECTION B
2 Marks Questions
10. In a database with two tables, DEPARTMENT (DeptID, DeptName) and
EMPLOYEE (EmpID, EmpName, DeptID), where DEPTID is the Primary Key in
DEPARTMENT and a Foreign Key in EMPLOYEE.
(a) If you try to insert a new employee with a DEPTID of 105 in Employee table, but
only departments 101-104 exist, which integrity rule is violated?
(b) If you delete Department 101, what happens to the employees in that department if
ON DELETE CASCADE is set?

11. (a) Categorize the following into DDL and DML Commands: SELECT, CREATE,
ALTER, UPDATE
(b) Explain any two constraints in SQL with suitable examples.

12. (a) What constraint should be applied on a table column so that duplicate values are not
allowed in that column, but NULL is allowed.
(b) What constraint should be applied on a table column so that NULL is not allowed
in that column, but duplicate values are allowed.

SECTION C

3 Marks Questions

13. A company maintains a table Product to store product details.


P_ID P_NAME PRICE CATEGORY
P01 Laptop 60000 Electronics
P02 Chair 3000 Furniture
P03 Smartphone 20000 Electronics
P04 Table 4500 Furniture
Answer the following:
(a) Suggest the Primary Key for this table and justify.
(b) After adding a new column BRAND, what will be the new degree and cardinality?
(c) Write SQL statements to: (i) Insert a new product record. (ii) Update
the PRICE of 'Chair' to 3500.

14. (a) Write a MySQL statement to create a table named INVENTORY for a
stationery shop with the following specifications:

Column Name Data Type Constraint


ITEMID Integer Primary Key
ITEMNAME Varchar(25) Should not be empty
CATEGORY Varchar(15) Default 'General'
STOCKDATE Date
UNITPRICE Decimal(6,2)

(b) Add a new item: ItemID: 501, ItemName: 'Gel Pen', Category: 'Office', StockDate: '2023-
11-20', UnitPrice: 25.50.
2
15. For the table INVENTORY created in Q14, Write statements to
(i) Increase the UnitPrice of all items in the 'General' category by 10%.
(ii) Remove all items that have a UnitPrice less than 5.00.

Answer Q16 to Q20 for the Wellness Center Database with tables:
Table: MEMBER (Member_id, Name, Age, Type, Fees)
Table: WORKOUT (Workout_id, Member_id, Exercise, Duration, Date)

16. Write SQL Statements for the following:


(a) Create both the tables, with Member_id being the foreign key in
WORKOUT table.
(b) Add a new workout record for Member_id: 'M101', Workout_id: 'W50',
Exercise: 'Yoga', Duration: 60, and Date: 20th June 2026.

17. (a)Display the names of all members whose Type is 'Premium'.


(b) Display the workout details performed between '2026-01-01' and '2026-03-31'.
(c) Display all member details sorted by Age in descending order.

18. (a) Decrease the Fees by 500 for all members who are older than 60 years.
(b) Delete the record of the member with Member_id = 'M105'.
(c) Update the Duration of Workout_id 'W22' to 45 minutes.

19. (a) Display all members whose Fees have not been assigned (i.e., Fees is NULL).
(b) Display the number of members in each Type (e.g., Basic, Premium).
(c) Display the names of members that start with the letter 'S'.

20. (a) Add a new column Email of type Varchar(50) to the MEMBER table.
(b) List all unique Exercise names recorded in the WORKOUT table.
(c) Write a command to change the Exercise name from 'Running' to 'Treadmill' for
all records in the WORKOUT table.

****************************************************

You might also like