0% found this document useful (0 votes)
3 views

SQL.

Uploaded by

exangeleena1867
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

SQL.

Uploaded by

exangeleena1867
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Questions -1

1. Predict the output of the following query:


SELECT MOD (9,0);
i. 0
ii. NULL
iii. NaN
iv. 9

2. Which of the following SQL functions does not belong to the Math functions
category?
i. POWER()
ii. ROUND()
iii. LENGTH()
iv. MOD()

3. 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:

15
4.

5.In SQL, the equivalent of UCASE() is:


i. UPPERCASE ()
ii. CAPITALCASE()
iii. UPPER()
iv. TITLE ()

6.What are aggregate functions in SQL? Name any two.

16
7.

8.

17
9.

10.

18
11.

Questions - 2

1. Write the output of the following SQL command :


select round(3456.885, 2);
(A) 3456.88
(B) 3456.89
(C) 3400
(D) 3500

2. An aggregate function performs a calculation on _________ and returns a


single value.
(A) single value
(B) multiple values
(C) no value
(D) None of the above

3. Which one of the following would arrange the rows in ascending order in
SQL ?
(A) SORT BY
(B) ALIGN BY
(C) GROUP BY
(D) ORDER BY

4. The __________ command can be used to select an existing database in SQL.

19
5.The SQL string function that returns the index of the first occurrence of
substring is __________ .

6.

7.

20
8.

9.

10.

21
Questions -3

1. Which of the following SQL queries is used to retrieve rows from the "customers"
table where the "email" column contains NULL values?
a. SELECT * FROM customers WHERE email = NULL;
b. SELECT * FROM customers WHERE email IS NOT NULL;
c. SELECT * FROM customers WHERE ISNULL(email);
d. SELECT * FROM customers WHERE email IS NULL;

2. You have a table called "employees" with columns "department" and "salary." You
want to find the highest salary in each department and display the results in
descending order of salary. Which SQL clauses should you use for this query?
a. GROUP BY, HAVING, ORDER BY
b. GROUP BY, ORDER BY
c. HAVING, ORDER BY
d. HAVING, GROUP BY

3. Which SQL function can be used to convert a text string to uppercase?


a. UCASE() b. LENGTH() c. MID() d. LTRIM()

4. You are working with a database that stores employee information. You need to
retrieve the current date and time. Which SQL function would you use for this purpose?

a. DATE() b. MONTH() c. DAY() d. NOW()

5. Predict the output of the following query: SELECT ROUND(15.789, 2);

a. 15.79 b. 15.789 c. 16 d. 15.8


6. Consider the given SQL QUERIES:
i. To retrieve the length of the given string "CBSE BOARD SQP @ 2023!", which SQL
function should you use?

a. LCASE() b. MID() c. LENGTH() d. TRIM()

ii. To findout if ‘@’ symbol is present in the values of email id column or not, which
function out of the following should be used?

a. Find() b. Instr() c. FindStr() d. OnStr()

7. Clarify the role of the HAVING clause highlighting its distinctions from the WHERE
clause in SQL.

22
8.

9.

10.

23

You might also like