Query Language MCQ Quiz - Objective Question with Answer for Query Language - Download Free PDF

Last updated on Jun 27, 2025

Latest Query Language MCQ Objective Questions

Query Language Question 1:

In relational database minimal super keys is known as -

  1. Reference keys
  2. Candidate keys
  3. Foreign keys
  4. Primary keys
  5. None of the above

Answer (Detailed Solution Below)

Option 2 : Candidate keys

Query Language Question 1 Detailed Solution

The correct option is (2)

Candidate key

Concept:-

The candidate key can be called a super key, as each candidate key is a subset of the super key. The super key with all necessary attributes is known as the candidate key. The super key with unnecessary attributes cannot be considered a candidate key.

Key Points

  • A Candidate key is a minimal super key, meaning that it would cease to be a super key if you removed any attribute from the set.
  • A minimum super key is referred to as a candidate and the main key since the primary key is chosen from the candidate keys.
  • The minimal set of attributes that can uniquely identify a tuple is known as candidate key. For example, STUD_NO in STUDENT relation. It is a minimal super key.

Additional InformationForeign keys:- The characteristic that establishes the relationship between tables is the foreign key of a table. A foreign key is a column or columns of data in one table that connects to the primary key data in the original table.

Primary key:- The very minimum set of characteristics necessary to identify each row in a database is known as the primary key. It is chosen from a list of potential keys. The primary key might be any candidate's key.

Reference key:- The primary key that is used as a reference in the other table is known as the Reference key.

Query Language Question 2:

Consider the following statements regarding key -

(I) A super key is an attribute or combination of attributes that uniquely identify records in an RDBMS table.

(II) A candidate key is a subset of a super key.

(III) All super keys are candidate keys but vice versa is not true.

  1. Only (I) is true
  2. (I) and (III) are true
  3. Only (II) is true
  4. (I) and (II) are true
  5. None of the above

Answer (Detailed Solution Below)

Option 4 : (I) and (II) are true

Query Language Question 2 Detailed Solution

The correct answer is (I) and (II) are true

Concept:

Statement 1: A super key is an attribute or combination of attributes that uniquely identify records in an RDBMS table.

True, A super key, or just key, is a combination of every attribute that may be used to specifically identify rows (or tuples) in a database. This indicates that a superkey may contain additional information that isn't required for uniquely identifying table rows.

Statement 2: A candidate key is a subset of a super key.

True, A Candidate key is a subset of Super keys and is clear of any unnecessary attributes that are not essential for tuple identification. For all tuples, the Candidate key value is distinct and non-null. Additionally, each table must include at least one Candidate key.

Statement 3: All super keys are candidate keys but vice versa is not true.

False, Candidate keys are a subset of Super keys. They contain only those attributes which are required to uniquely identify tuples. All Candidate keys are Super keys. But the vice-versa is not true.

Hence the correct answer is (I) and (II) are true.

Query Language Question 3:

Which of the following command can instantly delete all rows from the table while preserving table definition.

  1. DELETE
  2. TRUNCATE
  3. DROP
  4. REMOVE
  5. None of the above

Answer (Detailed Solution Below)

Option 2 : TRUNCATE

Query Language Question 3 Detailed Solution

The correct option is TRUNCATE

CONCEPT:

TRUNCATE command removes all rows from a table, but the table structure or definition remain.

DROP command can be used to remove the table definition in addition to its data.

DELETE command can be used to remove the specified rows(one or more) of the table.

Syntax:

TRUNCATE TABLE table_name;

DROP TABLE table_name;

DELETE FROM table_name WHERE condition;

Query Language Question 4:

Which of the following is NOT a key in Relational Model?

  1. Foreign Key
  2. Primary Key
  3. Duplicate Key
  4. Composite Key

Answer (Detailed Solution Below)

Option 3 : Duplicate Key

Query Language Question 4 Detailed Solution

The correct answer is Option 3) Duplicate Key.

Key Points

  • In the Relational Model of databases, keys are used to uniquely identify tuples (rows) in a relation (table).
  • Primary Key: A unique identifier for each record in a table. No two rows can have the same primary key, and it cannot contain NULLs.
  • Foreign Key: A field (or collection of fields) in one table that refers to the primary key in another table. It is used to establish and enforce a link between the data in the two tables.
  • Composite Key: A key made up of two or more attributes that together uniquely identify a record.
  • Duplicate Key ❌ is not a recognized concept in the relational model. The term contradicts the basic purpose of a key, which is to ensure uniqueness.

Additional Information

  • Candidate Key: A set of attributes that can uniquely identify a record. One of them is selected as the primary key.
  • Super Key: A set of attributes that uniquely identifies each record in a table. It may contain extra attributes not necessary for uniqueness.
  • All keys in relational models are meant to avoid duplication and enforce integrity.

Conclusion: Since the term "Duplicate Key" implies the presence of non-unique identifiers, it is not considered a valid key in the relational model.

Query Language Question 5:

Which of the following statement is correct about the following SQL query?
SELECT CourseName, Fees, StartDate, Duration FROM Students, Courses
WHERE Students.CourseID = Courses.CourseID
GROUP BY BookID

  1. It is a wrong query as attribute in the group by clause is not specified in the select clause.
  2. It is a wrong query since is used in place of
  3. It is a wrong query as multiple tables are used in the SELECT clause.
  4. It is correctly formed query.

Answer (Detailed Solution Below)

Option 1 : It is a wrong query as attribute in the group by clause is not specified in the select clause.

Query Language Question 5 Detailed Solution

The correct answer is Option 1) It is a wrong query as attribute in the GROUP BY clause is not specified in the SELECT clause.

Key Points

  • In SQL, when using the GROUP BY clause, all selected columns that are not aggregated must appear in the GROUP BY clause.
  • In the given query:
    SELECT CourseName, Fees, StartDate, Duration 
    FROM Students, Courses 
    WHERE Students.CourseID = Courses.CourseID 
    GROUP BY BookID
  • BookID is used in the GROUP BY clause but is not present in the SELECT list, and it is also not a part of any aggregation (like COUNT(), SUM(), etc.).
  • This violates the SQL standard rule and will result in an error in most RDBMS systems like MySQL, PostgreSQL, and SQL Server.

Additional Information

  • Option 2 – It is a wrong query since is used in place of: This statement is unclear and grammatically incorrect; it doesn’t specify any real SQL issue.
  • Option 3 – It is a wrong query as multiple tables are used in the SELECT clause: Not true. Joining multiple tables using WHERE is valid SQL.
  • Option 4 – It is correctly formed query: ❌ Incorrect. The mismatch between SELECT and GROUP BY columns makes the query invalid.

Conclusion: The SQL query is incorrect because it uses GROUP BY on a column that is neither in the SELECT clause nor used in an aggregate function.

Top Query Language MCQ Objective Questions

Consider the following statements S1 and S2 about the relational data model:

S1: A relation scheme can have at most one foreign key.

S2: A foreign key in a relation scheme R cannot be used to refer to tuples of R.

Which one of the following choices is correct? 

  1. S1 is true and S2 is false.  
  2. Both S1 and S2 are true.  
  3. Both S1 and S2 are false.  
  4. S1 is false and S2 is true. 

Answer (Detailed Solution Below)

Option 3 : Both S1 and S2 are false.  

Query Language Question 6 Detailed Solution

Download Solution PDF

Answer: Option 3

Concept

Foreign Key :is the set of attributes in a particular relation whose values are belongs to primary key of same relation or other relation.

Explanation

Statement 1: A relation scheme can have at most one foreign key.

There is no such restriction on how many number of Foreign keys a particular relation can have. A relation can have as many number of Foreign keys as Required

So this statement is false.

Statement 2: foreign key in a relation scheme R cannot be used to refer to tuples of R.

There is no such constraint. Foreign key can be used to refer to primary key of the same relation. Self-referencing relations are examples of such foreign key. So this statement is also false.

So option 3 is the correct answer.

Consider the relation scheme R = (E, F, G, H, I, J, K, L, M, N) and the set of functional dependencies {(E, F} → {G}, {F} → {I, J}, {E, H} → {K, L}, {K} → {M}, {L} → {N}} on R. What is the key for R ?

  1. {E, F}
  2. {E, F, H}
  3. {E, F, H, K, L}
  4. {E}

Answer (Detailed Solution Below)

Option 2 : {E, F, H}

Query Language Question 7 Detailed Solution

Download Solution PDF

Function Dependencies:

{(E, F} → {G}, {F} → {I, J}, {E, H} → {K, L}, {K} → {M}, {L} → {N}}

Option 1: {E, F}

{E, F}+ = {E, F, G, I, J}

Since K, L, M and N is missing in RHS ∴ it is not a key

Also, {E} cannot be a key because {E} is subset of {E, F}

Option 2: {E, F, H}

{E, F, H}+ = {E, F, H, G, I, J, K, L, M, N}

∴ it is a key

Key for R is {E, F, H}.

Important Points:

In relation algebra, key is primary key or candidate key.

{E, F, H, K, L} is super key. 

A prime attribute of a relation schema R is an attribute that appears

  1. in all candidate keys of R
  2. in some candidate key of R
  3. in a foreign key of R
  4. only in the primary key of R

Answer (Detailed Solution Below)

Option 2 : in some candidate key of R

Query Language Question 8 Detailed Solution

Download Solution PDF
  • Attributes of the relation which exist in at least one of the possible candidate keys, are called prime or key attributes
  • Candidate key is a minimal super key and a Super key is a set of attributes that uniquely identify a tuple in a relation.
  • Therefore, a prime attribute of a relation scheme R is an attribute that appears in some candidate key of R


Important Point:

  • Primary key is selected from a set of candidate keys of a relation.

Mistake Points 
Option 1) is not correct. Because a prime attribute is an attribute that can appear in any candidate key. The attribute need not appear in all candidate keys of R. Example:- if A is a prime attribute then for a relationship it is not required for A to be present in all candidate keys of relation R.

What is the full form of SQL?

  1. Simple Query Language
  2. Structured Queuing Language
  3. Structured Query Language
  4. Structured Queuing Lexicon

Answer (Detailed Solution Below)

Option 3 : Structured Query Language

Query Language Question 9 Detailed Solution

Download Solution PDF
Key Points

 SQL (Structured Query Language) is a standardized programming language that's used to manage relational databases and perform various operations on the data in them. ... SQL became the de facto standard programming language for relational databases after they emerged in the late 1970s and early 1980s.

  • SQL is regularly used not only by database administrators, but also by developers writing data integration scripts and data analysts looking to set up and run analytical queries.
  • The uses of SQL include modifying database table and index structures; adding, updating and deleting rows of data; and retrieving subsets of information from within a database for transaction processing and analytics applications.

Hence the correct answer is Structured Query Language.

_______ symbol is used to see every column of a table.

  1. /
  2. _ _
  3. *
  4. !

Answer (Detailed Solution Below)

Option 3 : *

Query Language Question 10 Detailed Solution

Download Solution PDF

The * symbol is used to see every column of a table.

 For Example, Let us consider a table Table1

ID NAME AGE ADDRESS SALARY
1 Akash 24 Bijnor 12000
2 sema 23 Delhi 15000
3 diya 33 Banglore 33000
4 Badal 29 Odisha 40000

If you want to fetch only some specific columns from the table, then we can use this query,

Select ID,NAME,AGE from Table1;    / Syntax is Select (column_name1, coloumn_name2.....coloum_name) from table_name;

ID NAME AGE
1 Akash 24
2 sema 23
3 diya 33
4 Badal 29

If you want to fetch all the fields of the Table1 table, then you should use the following query 

Select * from Table1;    Syntax is Select * from table_name;

ID NAME AGE ADDRESS SALARY
1 Akash 24 Bijnor 12000
2 sema 23 Delhi 15000
3 diya 33 Banglore 33000
4 Badal 29 Odisha 40000

Therefore Option 3 is correct

Which of the following is NOT a superkey in a relational schema with attributes V, W, X, Y, Z and primary key V Y?

  1. VXYZ
  2. VWXZ
  3. VWXY
  4. VWXYZ

Answer (Detailed Solution Below)

Option 2 : VWXZ

Query Language Question 11 Detailed Solution

Download Solution PDF

Concept:

Superkey is a set of attributes within a table whose values can be used to uniquely identify a tuple. A candidate key is a minimal superkey.

Superkey is superset of candidate key or primary key.

Explanation:

Primary key is VY. (given)

All superkeys must contain this primary key VY. From the given keys, key, which doesn’t contain

the VY.

Here, option 2: VWXZ

“VWXZ” doesn’t contain the primary key VY. So, it is not a superkey.

Properties of ‘DELETE’ and ‘TRUNCATE’ commands indicate that

  1. After the execution of ‘TRUNCATE’ operation, COMMIT, and ROLLBACK statements can be performed to retrieve the lost data, while ‘DELETE’ does not allow it.
  2. After the execution of ‘DELETE’ and ‘TRUNCATE’ operation retrieval is easily possible for the lost data
  3. After the execution of ‘DELETE’ operation, COMMIT and ROLLBACK statements can be performed to retrieve the lost data., while TRUNCATE do not allow it
  4. After the execution of ‘DELETE’ and ‘TRUNCATE’ operation no retrieval is possible for the lost data

Answer (Detailed Solution Below)

Option 3 : After the execution of ‘DELETE’ operation, COMMIT and ROLLBACK statements can be performed to retrieve the lost data., while TRUNCATE do not allow it

Query Language Question 12 Detailed Solution

Download Solution PDF

TRUNCATE

  • Is a DDL command hence it cannot be rolled back.
  • It resets the identity of the table and locks that state of the table.
  • Hence, Commit and Rollback will have no effect after TRUNCATE.

 

DELETE

  • Is a DML command hence it can be rolled back
  • It does not rest the identity of the table, it just locks the table row
  • Hence Commit and Rollback can have effect depending on the lock techniques used.

 

Hence, it can be said that after the execution of ‘TRUNCATE’ operation, COMMIT, and ROLLBACK statements cannot be performed to retrieve the lost data, while ‘DELETE’ allows it.

It can also be said that after the execution of ‘DELETE’ operation, COMMIT and ROLLBACK statements can be performed to retrieve the lost data, while TRUNCATE does not allow it

NOTE

In official ISRO CS 2020, both option 1 and 3 were correct and hence option is slightly modified to get only correct answer.

Consider a relational database containing the following schemes.

Catalogue

sno

pno

Cost

S1

P1

150

S1

P2

50

S1

P3

100

S2

P4

200

S2

P5

250

S3

P1

250

S3

P2

150

S3

P5

300

S3

P4

250

 

Suppliers

sno

sname

location

S1

M/s Royal furniture

Delhi

S2

M/s Balaji furniture

Bangalore

S3

M/s Premium furniture

Chennai

 

Parts

pno

Pname

Part_spec

P1

Table

Wood

P2

Chair

Wood

P3

Table

Steel

P4

Almirah

Steel

P5

Almirah

Wood

 

The primary key of each table is indicated by underling the constituent fields.

SELECT  s.sno, s.sname

FROM   Suppliers s, Cataloque c

WHERE s.sno = c.sno AND

                Cost > (SELECT AVG (cost)

FROM Cataloque

WHERE pno = ‘P4’

GROUP BY pno);

The number of rows returned by the above SQL query is

  1. 4
  2. 5
  3. 0
  4. 2

Answer (Detailed Solution Below)

Option 1 : 4

Query Language Question 13 Detailed Solution

Download Solution PDF

Inner Query: SELECT AVG (cost) FROM Cataloque WHERE pno = ‘P4’ GROUP BY pno

The execution of the inner query gives the average of the cost of parts with part-id P4

Output:

Avg (cost)

225

 

Outer Query:

SELECT s.sno, s.sname FROM Suppliers s, Cataloque c WHERE s.sno = c.sno AND Cost > (225)

The execution of the entire query output the following table:

sno

sname

S2

M/s Balaji furniture

S3

M/s Premium furniture

S3

M/s Premium furniture

S3

M/s Premium furniture

 

Hence, there are 4 rows in the resultant table. 

In relational database minimal super keys is known as -

  1. Reference keys
  2. Candidate keys
  3. Foreign keys
  4. Primary keys

Answer (Detailed Solution Below)

Option 2 : Candidate keys

Query Language Question 14 Detailed Solution

Download Solution PDF

The correct option is (2)

Candidate key

Concept:-

The candidate key can be called a super key, as each candidate key is a subset of the super key. The super key with all necessary attributes is known as the candidate key. The super key with unnecessary attributes cannot be considered a candidate key.

Key Points

  • A Candidate key is a minimal super key, meaning that it would cease to be a super key if you removed any attribute from the set.
  • A minimum super key is referred to as a candidate and the main key since the primary key is chosen from the candidate keys.
  • The minimal set of attributes that can uniquely identify a tuple is known as candidate key. For example, STUD_NO in STUDENT relation. It is a minimal super key.

Additional InformationForeign keys:- The characteristic that establishes the relationship between tables is the foreign key of a table. A foreign key is a column or columns of data in one table that connects to the primary key data in the original table.

Primary key:- The very minimum set of characteristics necessary to identify each row in a database is known as the primary key. It is chosen from a list of potential keys. The primary key might be any candidate's key.

Reference key:- The primary key that is used as a reference in the other table is known as the Reference key.

In context of a relation in database, choose a false statement:

  1. There can be more than one super keys.
  2. A candidate key is a minimal super key.
  3. One of the candidate keys is designated as primary key.
  4. Primary key is obtained by removing one or more attributes from a candidate key.

Answer (Detailed Solution Below)

Option 4 : Primary key is obtained by removing one or more attributes from a candidate key.

Query Language Question 15 Detailed Solution

Download Solution PDF

Super Key

  • It is an attribute (or set of attributes) that is used to uniquely identifies all attributes in a relation. 
  • All super keys can’t be candidate keys but its reverse is true. 
  • There can be more than one super key.
  • In relation, the number of super keys is always greater than or equal to the number of candidate keys.
  • There always exists at least one super key in a table.

Candidate key

  • It is a minimal set of attributes necessary to identify a tuple; this is also called a minimal super key.
  • Candidate key can be more than one.
  • One of the candidate keys is designated as the primary key.

Primary key

  • Candidate key from the table selected by the database administrator to uniquely identify tuples in a table known as the primary key.
  • Since the candidate is a minimal set of attributes necessary to identify a tuple therefore the primary key is also  a minimal set of attributes necessary to identify a tuple and hence primary key cannot be obtained by removing one or more attributes from a candidate key.

Therefore option 4 is false

Get Free Access Now
Hot Links: teen patti fun teen patti joy apk teen patti wink