a
askaideAI
Log in
— CHAPTER MASTERY · CLASS 12

Structured Query Language (SQL) Important Questions.

Master Structured Query Language (SQL) with AI-powered practice. Our adaptive tutor identifies your gaps and provides step-by-step explanations for every topic in this chapter.

Structured Query Language (SQL) — Important Questions with Answers

Practice these Structured Query Language (SQL) questions for Class 12 Computer Science, each with the correct answer and a step-by-step explanation. Sign up free to practice all 66+ questions with adaptive difficulty.

  1. Q1Easy

    What does the RIGHT function in SQL do?

    • A.Returns N number of characters from the right side of the string.
    • B.Returns N number of characters from the left side of the string.
    • C.Returns the length of the string.
    • D.Converts the string to uppercase.
    Answer: Returns N number of characters from the right side of the string.

    Explanation: The RIGHT function is used to extract a specified number of characters from the right side of a string. This is useful for retrieving the last few characters of a string, such as a file extension or a specific code.

  2. Q2Easy

    What is the purpose of the ORDER BY clause in SQL?

    • A.To filter records based on a condition.
    • B.To display the result of a SQL query in ascending or descending order.
    • C.To group records that have the same values in specified columns.
    • D.To join two or more tables together.
    Answer: To display the result of a SQL query in ascending or descending order.

    Explanation: The ORDER BY clause is used to sort the result set of a SQL query based on one or more columns. By default, it sorts the data in ascending order, but it can also be specified to sort in descending order.

  3. Q3Easy

    What does the IN operator do in SQL?

    • A.Selects values that match any value in the given list of values.
    • B.Selects values that are greater than a specified value.
    • C.Selects values that are less than a specified value.
    • D.Selects values that are equal to a specified value.
    Answer: Selects values that match any value in the given list of values.

    Explanation: The IN operator is used in SQL to filter records based on a list of specified values. It allows you to specify multiple values in a WHERE clause, making it easier to filter results without using multiple OR conditions.

  4. Q4Easy

    What is the purpose of the HAVING clause in SQL?

    • A.To filter records before grouping them.
    • B.To specify conditions on the rows with Group By clause.
    • C.To sort the results of a query.
    • D.To join two tables together.
    Answer: To specify conditions on the rows with Group By clause.

    Explanation: The HAVING clause is used in SQL to filter records that work on summarized GROUP BY results. It is similar to the WHERE clause but is used for aggregate functions, allowing you to filter groups based on aggregate values.

  5. Q5Medium

    What SQL statement is used to create a database?

    • A.CREATE TABLE databasename;
    • B.CREATE DATABASE databasename;
    • C.CREATE SCHEMA databasename;
    • D.CREATE RELATION databasename;
    Answer: CREATE DATABASE databasename;

    Explanation: The CREATE DATABASE statement is essential for establishing a new database in SQL. It specifies the name of the database to be created, allowing for organized data management.

  6. Q6Medium

    Which SQL clause is used to order the results of a query?

    • A.GROUP BY
    • B.ORDER BY
    • C.WHERE
    • D.HAVING
    Answer: ORDER BY

    Explanation: The ORDER BY clause is crucial for sorting query results based on specified columns. It can arrange data in ascending or descending order, enhancing data readability.

  7. Q7Medium

    What does the DISTINCT keyword do in an SQL query?

    • A.Sorts results
    • B.Removes duplicate values
    • C.Filters results
    • D.Joins tables
    Answer: Removes duplicate values

    Explanation: The DISTINCT keyword is used in SQL to ensure that the results of a query contain only unique values, eliminating any duplicates from the output set.

  8. Q8Medium

    What is the purpose of the NOT IN operator in SQL?

    • A.To include specific values
    • B.To exclude specific values
    • C.To join tables
    • D.To sort results
    Answer: To exclude specific values

    Explanation: The NOT IN operator is used in SQL to filter out records that match any of the specified values in a list, allowing for more precise data retrieval.

  9. Q9Hard

    What is the primary purpose of the INSERT INTO statement in SQL?

    • A.To delete records from a table
    • B.To update existing records
    • C.To add new records to a table
    • D.To retrieve data from a table
    Answer: To add new records to a table

    Explanation: The INSERT INTO statement is used to add new records to a table in a database. It specifies the table name and the values to be inserted into the specified columns. This is crucial for maintaining and updating the database with new information.

  10. Q10Hard

    Which SQL function is used to calculate the maximum value in a specified column?

    • A.SUM()
    • B.COUNT()
    • C.MAX()
    • D.MIN()
    Answer: MAX()

    Explanation: The MAX() function is an aggregate function in SQL that returns the maximum value from a specified column. It is commonly used in queries to find the highest value in a dataset, such as the highest salary in an employee table.

  11. Q11Hard

    What does the UNION operation do in SQL?

    • A.Joins two tables based on a common column
    • B.Combines the results of two or more SELECT statements
    • C.Filters records based on a condition
    • D.Sorts the results of a query
    Answer: Combines the results of two or more SELECT statements

    Explanation: The UNION operation in SQL is used to combine the results of two or more SELECT statements into a single result set. It removes duplicate records by default, ensuring that each row in the result is unique. This is useful for merging data from different tables that share similar structures.

  12. Q12Hard

    In SQL, what is the purpose of a primary key?

    • A.To allow duplicate records in a table
    • B.To uniquely identify each record in a table
    • C.To create a foreign key relationship
    • D.To index the table for faster queries
    Answer: To uniquely identify each record in a table

    Explanation: A primary key in SQL is a field (or a combination of fields) that uniquely identifies each record in a table. It ensures that no two records can have the same primary key value, which is essential for maintaining data integrity and establishing relationships between tables.

Practice all 66+ Structured Query Language (SQL) questions — free

Start Free Practice

How AskAide helps with Structured Query Language (SQL)

Exam-Ready Questions

Practice questions specifically designed for CBSE Class 12 Computer Science board exams. Covers all difficulty levels from basic to advanced.

Instant AI Doubts

Stuck on a tricky concept in Structured Query Language (SQL)? Our AI tutor provides immediate, step-by-step explanations 24/7.

Adaptive Practice

The difficulty adjusts as you learn. Master foundations first, then move to challenging board-level problems.

Why practice Structured Query Language (SQL) on AskAide?

Preparing for board exams requires more than just reading Structured Query Language (SQL) from the textbook. You need to apply concepts to different types of problems. AskAide's AI-powered platform makes this process seamless for Class 12 students.

Our question bank for Structured Query Language (SQL) is generated from the NCERT chapter text itself, so every question stays inside the syllabus. Whether it's complex numericals or conceptual theory, our AI tutor helps you break down every problem.

  • Unlimited practice questions for Structured Query Language (SQL)
  • Personalized feedback on your weak areas
  • NCERT-aligned curriculum for Computer Science
  • Free access for students across India

Ready to ace your exams?

Students across India are already practising their chapters on AskAide — free during early access.

Try for free now
Menu