STUDENT
DATABASE QUERY USING SQL
Total Q: 66
Time: 60 Mins
Q 1.
State whether the following statement is True or False:
The MOD() function in SQL returns the quotient of division operation between two numbers.
True
False
-
-
Q 2.
The SQL command that will display the current time and date is :
select date;
select now;
select now();
select date();
Q 3.
Which one of the following functions is used to find the largest value from the given data in MySQL?
MAX( )
MAXIMUM( )
BIG( )
LARGE( )
Q 4.
Which of the following function returns a string type value?
mod( )
instr( )
substr( )
month( )
Q 5.
Which one of the following is not an aggregate function?
ROUND()
SUM()
COUNT()
AVG()
Q 6.
Find the output of the following SQL queries :
Select INSTR("Data Science","ie");
8
-5
True
False
Q 7.
What is DBMS?
A software used to manage and organize databases.
A hardware device for storing data.
A programming language for creating websites.
An operating system used for multitasking.
Q 8.
The purpose of WHERE clause in a SQL statement is to:
Create a table
Filter rows based on a specific condition
Specify the columns to be displayed
Sort the result based on a column
Q 9.
To remove the leading spaces from data values in a column of MySQL table, we use
Left( )
Rtrim( )
Trim( )
Ltrim( )
Q 10.
Which of the following is a category of DQL (Data Query Language)?
SELECT
INSERT
DELETE
UPDATE
Q 11.
Which type of values will not be considered by SQL while executing the following statement?
SELECT COUNT(column name) FROM inventory;
Numeric value
text value
Null value
Date value
Q 12.
Write the output of the following SQL command.
select round(49.88);
49.88
49.8
49.0
50
Q 13.
What will be the output of the following query ?
SELECT SUBSTR("Swachh Survekshan",2,4)
wac
wach
shan
achh
Q 14.
Write the output of the following SQL command :
select pow(2,2*2);
16
2
4
8
Q 15.
Which of the following clause cannot work with SELECT statement in MYSQL?
FROM
INSERT INTO
WHERE
GROUP BY
Q 16.
Which of the following is a category of DDL (Data Definition Language)?
SELECT
CREATE
UPDATE
INSERT
Q 17.
The ____________command can be used to makes changes in the rows of a table in SQL.
Alter
Update
Insert
Modify
Q 18.
State whether the following statement is True or False:
The 'BETWEEN' operator in SQL is inclusive, meaning it includes the starting and ending values in the range.
True
False
-
-
Q 19.
Raj, a Database Administrator, needs to display the average pay of workers from those departments which have more than five employees. He is experiencing a problem while running the following query:
SELECT DEPT, AVG(SAL) FROM EMP WHERE COUNT(*) > 5 GROUP BY DEPT;
Which of the following is a correct query to perform the given task?
SELECT DEPT, AVG(SAL) FROM EMP WHERE COUNT(*) > 5 GROUP BY DEPT;
SELECT DEPT, AVG(SAL) FROM EMP HAVING COUNT(*) > 5 GROUP BY DEPT;
SELECT DEPT, AVG(SAL) FROM EMP GROUP BY DEPT WHERE COUNT(*) > 5;
SELECT DEPT, AVG(SAL) FROM EMP GROUP BY DEPT HAVING COUNT(*) > 5;
Q 20.
What will be the output of the following SQL command?
SELECT MONTHNAME('2024-08-02');
08
02
February
August
Q 21.
What will be the output of the following query ?
SELECT MOD (5, 15);
10
3
0
5
Q 22.
Which of the following is not an aggregate function in MYSQL ?
AVG ()
MAX ()
LCASE ()
MIN ()
Q 23.
Which of the following function in SQL returns an integer type value?
left( )
instr( )
substr( )
dayname( )
Q 24.
Which SQL function calculates a
b
?
MOD()
POWER()
RAISE()
ROUND()
Q 25.
Expand the term DBMS.
Database Management Software
Data Backup Management System
Database Management System
Digital Business Management Suite
Q 26.
The avg() function in MySql is an example of _________ .
Math function
Text function
Date Function
Aggregate Function
Q 27.
With respect to databases, a row in a relation is also known as a/an __________.
Attribute
Tuple
Field
Domain
Q 28.
_____ helps to fetch a group of rows based on common values in a column.
ORDER BY
FILTER
GROUP BY
SELECT BY
Q 29.
Fill in the Blank
The COUNT(*) function provides the total number of __________ within a relation (table) in a relational database.
Columns
Unique values
Not-null values
Rows
Q 30.
An aggregate function performs a calculation on _________ and returns a single value.
single value
multiple values
no value
None of these
Q 31.
Which one of the following would arrange the rows in ascending order in SQL ?
SORT BY
ALIGN BY
GROUP BY
ORDER BY
Q 32.
Which of the following is a DBMS?
Python
SQLite
Google Chrome
Canva
Q 33.
Which of the following is a DBMS?
Oracle
MS PowerPoint
MS Excel
WhatsApp
Q 34.
Assertion (A): In a table in SQL Domain defines the rules on the column.
Reason (R): In SQL, Candidate Key are columns which can become Primary Key.
Both Assertion (A) and Reason (R) are true, and Reason (R) is the correct explanation of Assertion(A)
Both Assertion (A) and Reason (R) are true, but Reason (R) is not the correct explanation of Assertion (A)
Assertion (A) is True, but Reason (R) is False
Assertion (A) is False, but Reason (R) is True
Q 35.
Which of the following is a DBMS?
PostgreSQL
Microsoft Word
TikTok
FileZilla
Q 36.
With reference to SQL, identify the invalid data type.
Date
Integer
Year
Month
Q 37.
Write the output of the following SQL query :
SELECT LCASE(SUBSTR("Project Management",9,6));
Manag
Manage
MANAGE
manage
Q 38.
Predict the output of the following query:
SELECT MOD (9,0);
0
NULL
NaN
9
Q 39.
State whether the following statement is True or False:
In SQL, the HAVING clause is used to apply filter on groups formed by the GROUP BY clause.
True
False
-
-
Q 40.
What is the output of the following SQL Query ?
SELECT INSTR("KNOWLEDGE","E");
7
5
6
-6
Q 41.
Which of the following is a category of DML (Data Manipulation Language)?
DROP
ALTER
INSERT
GRANT
Q 42.
To remove ONLY the trailing space from data values in a column of MySQL table, we use
Left( )
Rtrim( )
Trim( )
Ltrim( )
Q 43.
What will be the output of the following query ?
SELECT SUBSTR("G20 2023 INDIA",5,4);
G20 2
2023
INDI
023
Q 44.
Which MySQL command helps to add a primary key constraint to any table that has already been created ?
UPDATE
INSERT INTO
ALTER TABLE
ORDER BY
Q 45.
Now() in MySQL returns _______________.
Today's date
Today's date and current time
System's date and time
Name of active database
Q 46.
In SQL, ________ returns the month name from the specified date.
MONTH( )
DATE( )
MONTHNAME( )
NOW( )
Q 47.
With respect to SQL, match the function given in column-II with categories given in column-I:
(i)-(c), (ii)-(d), (iii)-(a), (iv)-(b)
(i)-(b), (ii)-(a), (iii)-(d), (iv)-(c)
(i)-(b), (ii)-(d), (iii)-(a), (iv)-(c)
(i)-(b), (ii)-(c), (iii)-(d), (iv)-(a)
Q 48.
Identify the SQL command used to delete a relation (table) from a relational database.
DROP TABLE
REMOVE TABLE
DELETE TABLE
ERASE TABLE
Q 49.
Predict the output of the following query:
SELECT LCASE (MONTHNAME ('2023-03-05'));
May
March
may
march
Q 50.
What is a domain in SQL?
A web address used to connect databases
A set of allowable values for a column
The main server that hosts the database
A specific SQL keyword for joining tables
Q 51.
The SQL string function that returns the position of the first occurrence of substring is ________ .
MID
INSTRING
INSTR
POSITION
Q 52.
What is a tuple in SQL?
A type of SQL command for updating data
A single row of a table
A function used to sort data
A constraint applied to primary keys
Q 53.
Assertion (A): The ROUND() function in SQL can be used to round off a number to a specified number of decimal places.
Reason (R): The ROUND() function is a string function that accepts character values as input and returns numerical values as output.
Both Assertion (A) and Reason (R) are True and Reason (R) is the correct explanation for Assertion (A).
Both Assertion (A) and Reason (R) are True and Reason (R) is not the correct explanation for Assertion (A).
Assertion (A) is True and Reason (R) is False.
Assertion (A) is False, but Reason (R) is True.
Q 54.
Which of the following aggregate function returns the average of values in a specified column of a MySQL table ?
AVG(Column)
AVERAGE(Column)
MEAN(Column)
TOTAL(Column)
Q 55.
Which of the following is not an aggregate function in SQL?
COUNT(*)
MIN()
LEFT()
AVG()
Q 56.
Which of the following SQL function returns the number of values in the specified column ignoring the NULL values ?
COUNT(*)
COUNT(columnname)
LENGTH(*)
LENGTH(columnname)
Q 57.
Which SQL statement do we use to find out the total number of records present in the table ORDERS?
SELECT * FROM ORDERS;
SELECT COUNT (*) FROM ORDERS;
SELECT FIND (*) FROM ORDERS;
SELECT SUM () FROM ORDERS;
Q 58.
Which of the following is a DBMS?
MS Word
MySQL
Python
SQL
Q 59.
What will be the output of the following query ?
SELECT POWER(2, MOD(17,3));
8
1
0
4
Q 60.
Which MySQL string function is used to extract a substring from a given string based on a specified starting position and length ?
SUBSTRING_INDEX ()
LENGTH ()
MID()
TRIM()
Q 61.
What is a relation in SQL?
A link between two databases
A type of user permission
A table in the database
A keyword used to filter records
Q 62.
Match the following SQL functions/clauses with their descriptions:
P-2, Q-4, R-3, S-1
P-2, Q-4, R-1, S-3
P-4, Q-3, R-2, S-1
P-4, Q-2, R-1, S-3
Q 63.
Assertion (A): In SQL, INSERT INTO is a Data Definition Language (DDL) Command.
Reason (R): DDL commands are used to create, modify, or remove database structures, such as tables.
Both Assertion (A) and Reason (R) are true, and Reason (R) is the correct explanation of Assertion (A)
Both Assertion (A) and Reason (R) are true, but Reason (R) is not the correct explanation of Assertion (A)
Assertion (A) is True, but Reason (R) is False
Assertion (A) is False, but Reason (R) is True
Q 64.
In SQL, the equivalent of UCASE() is:
UPPERCASE ()
CAPITALCASE()
UPPER()
TITLE ()
Q 65.
Which of the following SQL functions does not belong to the Math functions category?
POWER()
ROUND()
LENGTH()
MOD()
Q 66.
Write the output of the following SQL command :
select round(3456.885, 2);
3456.88
3456.89
3400
3500