MySql Quiz

Question 1

4

DESC

3

GROUP BY

2

ORDER BY

1

ASC

Find odd one out

Question 2

4

DESC

3

GROUP BY

2

ORDER BY

1

ASC

What will be the output of the following MySQL statement?

 

SELECT customer_id, product_id, avail_balance
FROM account
WHERE avail_balance BETWEEN 3000 AND 5000.

Question 3

4

DESC

3

GROUP BY

2

ORDER BY

1

ASC

Find odd one out

Question 1

4

DESC

3

GROUP BY

2

ORDER BY

1

ASC

Find odd one out

Question 1

4

DESC

3

GROUP BY

2

ORDER BY

1

ASC

Find odd one out

Question 1

4

DESC

3

GROUP BY

2

ORDER BY

1

ASC

Find odd one out

Question 1

Primary Key vs Unique Key

๐Ÿ”‘ Primary Key :-

โ€ข โŒ NULL values are not allowed
โ€ข 1๏ธโƒฃ Only one PRIMARY KEY per table
โ€ข ๐Ÿ†” Uniquely identifies every row

๐Ÿ”‘ Unique Key :-

โ€ข โš ๏ธ Allows one NULL value
โ€ข ๐Ÿ”ข Multiple UNIQUE keys per table
โ€ข โœ”๏ธ Ensures uniqueness with flexibility

Question 2

Types of Joins

Question 3

Delete vs Truncate vs Drop

             ๐Ÿ—‘๏ธ Delete

  • ๐Ÿ”Ž Supports WHERE clause

  • โ™ป๏ธ Can be rolled back

  • ๐ŸŽฏ Deletes selected records only

 

           โšก Truncate

  • ๐Ÿš€ Faster than DELETE

  • โŒ Cannot use WHERE clause

  • ๐Ÿงน Removes all records quickly

 

            ๐Ÿ’ฅ Drop

  • ๐Ÿ—‚๏ธ Removes structure + data

  • โš ๏ธ Cannot be undone easily

  • ๐Ÿ—‘๏ธ Deletes the complete table

 

Question 4

Where vs Having

Filter Rows (WHERE)

Filter Groups (HAVING)

Group Rows (GROUP BY)

HAVING

Filters after GROUP BY. Designed to work with aggregate functions for grouped results.

 

 

WHERE

Filters rows before GROUP BY is applied. Cannot use aggregate functions like COUNT() or SUM().

 

Question 5

What is Group by?

What It Does:-

Groups rows that share the same values into summary rows. Always used alongside aggregate functions.

Example:-

SELECT department,

  AVG(salary) AS avg_salary

FROM employees

GROUP BY department;

 

Aggregate Functions:-

You've Got This!

 

Walk into your SQL interview with confidence. Master these core SQL concepts and you'll stand out as a top candidate.

๐Ÿš€ All the Best!

Copy of Interview Questions - SQL

By Content ITV

Copy of Interview Questions - SQL

  • 7