Home Subjects Database

Database

SQL queries, DBMS, normalization, transactions

12 Q 1 Topics Take Mock Test
Advertisement
Difficulty: All Easy Medium Hard 11–12 of 12
Topics in Database
All SQL Basics 57
Q.11 Hard SQL Basics
What will be the output of: SELECT MAX(salary) FROM employees GROUP BY department;
A The maximum salary across all departments
B The maximum salary for each department
C The minimum salary in each department
D An error because MAX and GROUP BY cannot be used together
Correct Answer:  B. The maximum salary for each department
EXPLANATION

MAX() with GROUP BY returns the maximum salary value for each distinct department.

Test
Q.12 Hard SQL Basics
Consider a table with columns: id, name, salary. If a row has NULL salary, what will SELECT * FROM table WHERE salary = NULL return?
A The row with NULL salary
B No rows (NULL cannot be compared with =)
C All rows
D An error message
Correct Answer:  B. No rows (NULL cannot be compared with =)
EXPLANATION

NULL values cannot be compared using = operator. To check for NULL, use IS NULL or IS NOT NULL.

Test
IGET
IGET AI
Online · Exam prep assistant
Hi! 👋 I'm your iget AI assistant.

Ask me anything about exam prep, MCQ solutions, study tips, or strategies! 🎯
UPSC strategy SSC CGL syllabus Improve aptitude NEET Biology tips