Updated On : September 4, 2023
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!
Here's how to prepare for CBSE Class 12 Computer Science sql questions -
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.
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.
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.
SELECT StudentName FROM Students WHERE Marks > 90;
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;
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;
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;
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;
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 ;
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.
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%';
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.
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?