Query Language MCQ Quiz in मल्याळम - Objective Question with Answer for Query Language - സൗജന്യ PDF ഡൗൺലോഡ് ചെയ്യുക
Last updated on Mar 13, 2025
Latest Query Language MCQ Objective Questions
Top Query Language MCQ Objective Questions
Query Language Question 1:
Which of following is incorrect SQL?
Answer (Detailed Solution Below)
Query Language Question 1 Detailed Solution
Aggregate functions are functions that take a collection (a set or multiset) of values as input and return a single value.
The input to sum and avg must be a collection of numbers, but the other operators can operate on collections of non-numeric data types, such as strings.
Sum function cannot work on two columns.Query Language Question 2:
In relational database minimal super keys is known as -
Answer (Detailed Solution Below)
Query Language Question 2 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 3:
Which SQL function is used to extract the day of the week from a date?
Answer (Detailed Solution Below)
Query Language Question 3 Detailed Solution
c) DAYNAME() is used to extract the day of the week from a date in SQL.
It returns a string representing the day of the week (e.g. "Monday", "Tuesday", etc.) for the given date.
Additional InformationIn SQL, DATE() is a function that can be used to extract the date part of a DATE or DATETIME value.
YEAR() function can be used to extract the year part of a DATE or DATETIME value.
MONTH() function can be used to extract the month part of a DATE or DATETIME value.
Query Language Question 4:
In context of a relation in database, choose a false statement:
Answer (Detailed Solution Below)
Query Language Question 4 Detailed Solution
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
Query Language Question 5:
SELECT operation in SQL is equivalent to
Answer (Detailed Solution Below)
Query Language Question 5 Detailed Solution
Query Language Question 6:
Which of the following data base is suitable for set or table?
Answer (Detailed Solution Below)
Query Language Question 6 Detailed Solution
The correct answer is option 3.
Concept:
Database:
A database is a data structure that organizes and stores data. Most databases have numerous tables, each of which may contain multiple fields.
Relational database management system:
A relational database management system (RDBMS) is a set of applications and features that allow IT professionals and others to develop, edit, administer, and interact with relational databases. Most commercial relational database management systems use Structured Query Language (SQL) to access the database, which is stored in the form of tables.
Different data structures and their suitable database:
- Tree ---- Hierarchical DBMS
- Graph ---- Network DBMS
- Set or Table ---- Relational DBMS
- Objects ---- Object-oriented DBMS
- Object or Tables ---- Object-Relational DBMS
Hence the correct answer is Relational DBMS.
Query Language Question 7:
What is the degree of the given relation student?
Example:
CREATE TABLE STUDENT( RollNumber INT, SName VARCHAR(20), SDateofBirth DATE, SAddress VARCHAR (100), PRIMARY KEY (RollNumber));
Hint:
Degree specifies the number of attributes of the relation.
Answer (Detailed Solution Below)
Query Language Question 7 Detailed Solution
The correct answer is option 3.
Concept:
In the given data, the Degree specifies the number of attributes of the relation.
Explanation:
The given example is,
CREATE TABLE STUDENT( RollNumber INT, SName VARCHAR(20), SDateofBirth DATE, SAddress VARCHAR (100), PRIMARY KEY (RollNumber));
Create command creates a table with given attributes and Mysql structure is like,
STUDENT:
RollNumber | SName | SDateofBirth | SAddress |
Here RollNuber is the primary key means it does not take null and duplicate values.
Hence the student table has four attributes(RollNumber, SName, SDateofBirth, SAddress).
Hence the correct answer is 4.
Query Language Question 8:
Which of the following represents the three basic SQL DML commands?
Answer (Detailed Solution Below)
Query Language Question 8 Detailed Solution
SQL: Structured Query Language, commonly abbreviated to SQL is a language used in Relational Databases. This mainly focuses on creating a database and executing queries against a database.
SQL comprises both data definition and data manipulation language (DML).
Important Points
DML: Data Manipulation Language (DML) is used to modify the instance of the database by inserting, updating, and deleting its data.
- Insert into/ values:- It is used to insert data into a table.
- Update/set/were:- It is used to update existing data within a table.
- Delete from / where:- It is used to delete records from a database table.
Additional Information
Data Definition Language (DDL):- It is used to design and modify the database schema.
- Create: It is used to create new databases, tables, and views from RDBMS.
- Drop: It is used to drop databases, tables, and views.
- Alter: It is used to modify database schema from RDBMS.
Query Language Question 9:
Let X (a, b, c, d) and Y (p, q, r, s) be two relations in which a is the foreign key of X that refers to the primary key of Y. Which of the following operation causes the referential integrity constraint violation?
Answer (Detailed Solution Below)
Query Language Question 9 Detailed Solution
Attribute of X is referring to attribute of Y:
If a row is deleted from X, no violation, since X is a referring relation and hence no violation
But if a row is inserted into X, since X is referring to Y, X may contain value outside the domain of primary key of Y.
If a row is inserted into Y, no violation, since Y is not referring to any other table and hence no violation
But if a row is deleted from Y, since Y is being referred by X, referred value may be deleted which leads to violation.
Hence Insert into Y and Delete from X doesn’t cause violation but insert into X causes violation.
Query Language Question 10:
Consider the schema
Sailors(sid, sname, rating, age) with the following data
Sid |
Sname |
Rating |
age |
22 |
Dustin |
7 |
45 |
29 |
Borg |
1 |
33 |
31 |
Pathy |
8 |
55 |
32 |
Robert |
8 |
25 |
58 |
Raghu |
10 |
17 |
64 |
Herald |
7 |
35 |
71 |
Vishnu |
10 |
16 |
74 |
King |
9 |
35 |
85 |
Archer |
3 |
26 |
84 |
Bob |
3 |
64 |
96 |
Flinch |
3 |
17 |
For the query
SELECT S.rating, AVG(S.age) AS avgage FROM Sailors S
Where S.age >= 18
GROUP BY S.rating
HAVING 1 < (SELECT COUNT(*) FROM Sailors S2 where S.rating = S2.rating)
The number of rows returned is
Answer (Detailed Solution Below)
Query Language Question 10 Detailed Solution
Without "having" clause query calculates the average age (where age >= 18) and groups by ratings so table returned is:
Rating | Average |
---|---|
1 | 33 |
3 | 45 |
7 | 40 |
8 | 40 |
9 | 35 |
After applying "having" clause table returned is:
Rating | Average |
---|---|
3 | 45 |
7 | 40 |
8 | 40 |