CBSE Class 12 Computer Science SQL Questions

Author : Palak Khanna

Updated On : September 4, 2023

SHARE

Summary: Master the art of database management in CBSE Class 12 Computer Science with these potential CBSE Class 12 Computer Science SQL Questions. Enhance your SQL skills and ensure you're ready for the exam!

Structured Query Language (SQL) forms a crucial part of the CBSE Class 12 Computer Science curriculum.

It is the language that allows one to interact with and manipulate databases. 

With a blend of theoretical understanding and practical application, mastering SQL can be a breeze. 

But the question arises - how can students optimally prepare for SQL questions in the examination? By practising CBSE Class 12 Computer Science SQL Questions! 

Preparation Tips to Approach CBSE Class 12 Computer Science SQL Questions

Here's how to prepare for CBSE Class 12 Computer Science sql questions - 

  • Understand the Basics: Grasp the fundamental concepts of databases like tables, relationships, keys, and normal forms.
  • Hands-on Practice: SQL is best learned by doing. Ensure you are practically executing each query type on an actual database.
  • Conceptual Clarity: Beyond writing queries, understand why a particular query is used and when to apply it.
  • Review Sample Problems: Regularly practice with sample questions and previous years' papers.
  • Seek Feedback: Consult your teacher or peers to evaluate the correctness of your queries.

Several websites offer CBSE class 12 computer science sql questions pdf. Ensure you download these class 12 SQL questions with answers pdf and start practising them.

Check: CBSE Class 12 Computer Science Important Question with Solutions

15 Sample CBSE Class 12 Computer Science SQL Questions

Here are sample CBSE Class 12 Computer Science SQL Questions with solutions for practise! 

CBSE Class 12 Computer Science SQL Questions 1 - Write SQL commands to create a table 'STUDENT' with columns 'Roll_No', 'Name', and 'Marks'. Ensure 'Roll_No' is the primary key.

Solution:

CREATE TABLE STUDENT ( Roll_No INT PRIMARY KEY, Name VARCHAR(255) NOT NULL, Marks FLOAT NOT NULL );

CBSE Class 12 Computer Science SQL Questions 2 - Write a SQL query to display the names of students who scored above 90 marks.

Solution:

SELECT StudentName FROM Students WHERE Marks > 90;

Check: CBSE Class 12 Computer Science Practical Viva Questions

CBSE Class 12 Computer Science SQL Questions 3 - How would you modify the table 'STUDENT' to add a new column 'DOB' for the date of birth?

ALTER TABLE STUDENT ADD COLUMN DOB DATE;

CBSE Class 12 Computer Science SQL Questions 4 - Write a query to rename the table 'STUDENT' to 'SCHOLARS'.

ALTER TABLE STUDENT RENAME TO SCHOLARS;

cuet online coaching

cuet online coaching

CBSE Class 12 Computer Science SQL Questions 5 - How would you delete all the records from the table 'SCHOLARS' where marks are below 40?

DELETE FROM SCHOLARS WHERE marks < 40;

Check: CBSE Class 12 Computer Science Books

CBSE Class 12 Computer Science SQL Questions 6 - Write an SQL query to count the number of students who have marks between 50 and 70.

SELECT COUNT(*) FROM students WHERE marks BETWEEN 50 and 70;

CBSE Class 12 Computer Science SQL Questions 7 - How can you retrieve unique marks from the 'SCHOLARS' table?

Query: ALTER TABLE SCHOLARS RENAME TO STUDENT_MARKS;

CBSE Class 12 Computer Science SQL Questions 8 - Write a SQL statement to find the average marks of students in the 'SCHOLARS' table.

RENAME TABLE SCHOLARS TO SCHOLAR_MARKS; SELECT AVG(mark) FROM SCHOLAR_MARKS;

Check: CBSE Class 12 Computer Science Syllabus 

CBSE Class 12 Computer Science SQL Questions 9 - How would you retrieve the top 5 students based on marks?

SELECT TOP 5 * FROM Students ORDER BY Marks DESC;

Check: How to Prepare Computer Science for Judiciary Exams?

CBSE Class 12 Computer Science SQL Questions 10 - Write a SQL command to update the marks of a student with Roll_No = 10 to 95.

UPDATE student SET marks = 95 WHERE Roll_No = 10;

CBSE Class 12 Computer Science SQL Questions 11 - How can you remove the column 'DOB' from the 'SCHOLARS' table?

Use the SQL ALTER TABLE command to remove the 'DOB' column from the 'SCHOLARS' table.

ALTER TABLE SCHOLARS DROP COLUMN DOB ;

cuet mock test

cuet mock test

CBSE Class 12 Computer Science SQL Questions 12 - Write an SQL statement to find the student with the highest marks.

SELECT Max(marks) AS 'Highest Marks', name FROM students GROUP BY name;

CBSE Class 12 Computer Science SQL Questions 13 - Create an index on the 'Name' column of the 'SCHOLARS' table.

ALTER TABLE SCHOLARS ADD INDEX (Name);

Check: CBSE 2023 Toppers Talk

CBSE Class 12 Computer Science SQL Questions 14 - Describe the difference between INNER JOIN and LEFT JOIN with examples.

An INNER JOIN is a type of join that returns only the rows with data in both the joined tables. It is the default join type of the SQL query. For example, let's say we have two tables: Table1 and Table2. If we perform an INNER JOIN on these two tables like this:

Select * from Table1
INNER JOIN Table2 on Table1.id = Table2.ID

It will only return the rows where the data in both tables matches.

A LEFT JOIN on the other hand is a type of join that returns all the data from the left table, even if there is no match in the right table. For example, if we perform a LEFT JOIN like this: 

Select * from Table1
LEFT JOIN Table2 on Table1.id= Table2.ID

It will return all the rows from Table1, regardless of whether they have a match in Table2.

Check: Business Management Courses after 12th

CBSE Class 12 Computer Science SQL Questions 15 - Write a SQL query to find all students whose name starts with the letter 'A'.

SELECT * FROM Students

WHERE name LIKE 'A%';

Conclusion

SQL is not just a part of the curriculum; it's a skill that's in high demand in today's technology-driven world. Mastering SQL in Class 12 not only helps in scoring well in exams but also lays a strong foundation for higher studies and industry requirements. Approach the subject with curiosity, practice regularly, and ensure you test your knowledge through sample questions.

Check: Class 12 Business Studies Important Questions

Frequently Asked Questions

Is it necessary to practice SQL on a computer?

How different is SQL from other programming languages?

What software can I use to practice SQL?

Are normalisation concepts important for SQL questions?

How important are SQL functions in the examination?

CBSE Class 12 Computer Science SQL Questions

Author : Palak Khanna

September 4, 2023

SHARE

Summary: Master the art of database management in CBSE Class 12 Computer Science with these potential CBSE Class 12 Computer Science SQL Questions. Enhance your SQL skills and ensure you're ready for the exam!

Structured Query Language (SQL) forms a crucial part of the CBSE Class 12 Computer Science curriculum.

It is the language that allows one to interact with and manipulate databases. 

With a blend of theoretical understanding and practical application, mastering SQL can be a breeze. 

But the question arises - how can students optimally prepare for SQL questions in the examination? By practising CBSE Class 12 Computer Science SQL Questions! 

Preparation Tips to Approach CBSE Class 12 Computer Science SQL Questions

Here's how to prepare for CBSE Class 12 Computer Science sql questions - 

  • Understand the Basics: Grasp the fundamental concepts of databases like tables, relationships, keys, and normal forms.
  • Hands-on Practice: SQL is best learned by doing. Ensure you are practically executing each query type on an actual database.
  • Conceptual Clarity: Beyond writing queries, understand why a particular query is used and when to apply it.
  • Review Sample Problems: Regularly practice with sample questions and previous years' papers.
  • Seek Feedback: Consult your teacher or peers to evaluate the correctness of your queries.

Several websites offer CBSE class 12 computer science sql questions pdf. Ensure you download these class 12 SQL questions with answers pdf and start practising them.

Check: CBSE Class 12 Computer Science Important Question with Solutions

15 Sample CBSE Class 12 Computer Science SQL Questions

Here are sample CBSE Class 12 Computer Science SQL Questions with solutions for practise! 

CBSE Class 12 Computer Science SQL Questions 1 - Write SQL commands to create a table 'STUDENT' with columns 'Roll_No', 'Name', and 'Marks'. Ensure 'Roll_No' is the primary key.

Solution:

CREATE TABLE STUDENT ( Roll_No INT PRIMARY KEY, Name VARCHAR(255) NOT NULL, Marks FLOAT NOT NULL );

CBSE Class 12 Computer Science SQL Questions 2 - Write a SQL query to display the names of students who scored above 90 marks.

Solution:

SELECT StudentName FROM Students WHERE Marks > 90;

Check: CBSE Class 12 Computer Science Practical Viva Questions

CBSE Class 12 Computer Science SQL Questions 3 - How would you modify the table 'STUDENT' to add a new column 'DOB' for the date of birth?

ALTER TABLE STUDENT ADD COLUMN DOB DATE;

CBSE Class 12 Computer Science SQL Questions 4 - Write a query to rename the table 'STUDENT' to 'SCHOLARS'.

ALTER TABLE STUDENT RENAME TO SCHOLARS;

cuet online coaching

cuet online coaching

CBSE Class 12 Computer Science SQL Questions 5 - How would you delete all the records from the table 'SCHOLARS' where marks are below 40?

DELETE FROM SCHOLARS WHERE marks < 40;

Check: CBSE Class 12 Computer Science Books

CBSE Class 12 Computer Science SQL Questions 6 - Write an SQL query to count the number of students who have marks between 50 and 70.

SELECT COUNT(*) FROM students WHERE marks BETWEEN 50 and 70;

CBSE Class 12 Computer Science SQL Questions 7 - How can you retrieve unique marks from the 'SCHOLARS' table?

Query: ALTER TABLE SCHOLARS RENAME TO STUDENT_MARKS;

CBSE Class 12 Computer Science SQL Questions 8 - Write a SQL statement to find the average marks of students in the 'SCHOLARS' table.

RENAME TABLE SCHOLARS TO SCHOLAR_MARKS; SELECT AVG(mark) FROM SCHOLAR_MARKS;

Check: CBSE Class 12 Computer Science Syllabus 

CBSE Class 12 Computer Science SQL Questions 9 - How would you retrieve the top 5 students based on marks?

SELECT TOP 5 * FROM Students ORDER BY Marks DESC;

Check: How to Prepare Computer Science for Judiciary Exams?

CBSE Class 12 Computer Science SQL Questions 10 - Write a SQL command to update the marks of a student with Roll_No = 10 to 95.

UPDATE student SET marks = 95 WHERE Roll_No = 10;

CBSE Class 12 Computer Science SQL Questions 11 - How can you remove the column 'DOB' from the 'SCHOLARS' table?

Use the SQL ALTER TABLE command to remove the 'DOB' column from the 'SCHOLARS' table.

ALTER TABLE SCHOLARS DROP COLUMN DOB ;

cuet mock test

cuet mock test

CBSE Class 12 Computer Science SQL Questions 12 - Write an SQL statement to find the student with the highest marks.

SELECT Max(marks) AS 'Highest Marks', name FROM students GROUP BY name;

CBSE Class 12 Computer Science SQL Questions 13 - Create an index on the 'Name' column of the 'SCHOLARS' table.

ALTER TABLE SCHOLARS ADD INDEX (Name);

Check: CBSE 2023 Toppers Talk

CBSE Class 12 Computer Science SQL Questions 14 - Describe the difference between INNER JOIN and LEFT JOIN with examples.

An INNER JOIN is a type of join that returns only the rows with data in both the joined tables. It is the default join type of the SQL query. For example, let's say we have two tables: Table1 and Table2. If we perform an INNER JOIN on these two tables like this:

Select * from Table1
INNER JOIN Table2 on Table1.id = Table2.ID

It will only return the rows where the data in both tables matches.

A LEFT JOIN on the other hand is a type of join that returns all the data from the left table, even if there is no match in the right table. For example, if we perform a LEFT JOIN like this: 

Select * from Table1
LEFT JOIN Table2 on Table1.id= Table2.ID

It will return all the rows from Table1, regardless of whether they have a match in Table2.

Check: Business Management Courses after 12th

CBSE Class 12 Computer Science SQL Questions 15 - Write a SQL query to find all students whose name starts with the letter 'A'.

SELECT * FROM Students

WHERE name LIKE 'A%';

Conclusion

SQL is not just a part of the curriculum; it's a skill that's in high demand in today's technology-driven world. Mastering SQL in Class 12 not only helps in scoring well in exams but also lays a strong foundation for higher studies and industry requirements. Approach the subject with curiosity, practice regularly, and ensure you test your knowledge through sample questions.

Check: Class 12 Business Studies Important Questions

Frequently Asked Questions

Is it necessary to practice SQL on a computer?

How different is SQL from other programming languages?

What software can I use to practice SQL?

Are normalisation concepts important for SQL questions?

How important are SQL functions in the examination?

ABOUT TOP RANKERS

Toprankers, launched in 2016, is India’s most preferred digital counselling & preparation platform for careers beyond engineering & medicine. We envision to build awareness and increase the success rate for lucrative career options after 12th. We offer best learning practices and end-to-end support to every student preparing for management, humanities, law, judiciary & design entrances.

E

: support@toprankers.com

P

: +91-7676564400

Social Channels

App Badge

Chat to Toprankers Team