MYSQL DATABASE INTERVIEW QUESTIONS

Course:MySQL
Chapter:Chapter 7 - DQL (Data Query Language)
Topic:SELECT *
Questions Count:58
1

What does the SELECT * statement do in MySQL?

Explanation:
2

How would you retrieve all columns from a table named customers?

Explanation:
3

What are the potential downsides of using SELECT * in a query?

Explanation:
4

How can you limit the number of rows returned by a SELECT * query in MySQL?

Explanation:
5

What is the difference between SELECT * and SELECT column1, column2?

Explanation:
6

How can you filter the rows returned by a SELECT * query?

Explanation:
7

Explain how to use SELECT * with an alias for a table in MySQL.

Explanation:
8

How can you use SELECT * in a subquery within a MySQL statement?

Explanation:
9

Describe the impact of using SELECT * in a join operation.

Explanation:
10

During a database certification exam, you are asked to explain when and why you might avoid using SELECT * in production queries. What would be your response?

Explanation:
11

How do you query a hierarchy of employees in MySQL when the employee table has a manager ID that points to their supervisor?

Explanation:
12

How can you represent a hierarchy of employees in a database?

Explanation:
13

How would you query all employees reporting directly to a specific manager in MySQL?

Explanation:
14

How can you retrieve all employees under a specific manager, including indirect reports (multi-level hierarchy)?

Explanation:
15

How do you determine the hierarchy level of an employee in the organization?

Explanation:
16

What challenges might arise when querying hierarchical data, and how can they be addressed in MySQL?

Explanation:
17

To fetch ALTERNATE records from a table. (EVEN NUMBERED)

Explanation:
18

To select ALTERNATE records from a table. (ODD NUMBERED)

Explanation:
19

Find the 3rd MAX salary in the emp table.

Explanation:
20

Find the 3rd MIN salary in the emp table.

Explanation:
21

Select FIRST n records from a table.

Explanation:
22

Select LAST n records from a table

Explanation:
23

List dept no., Dept name for all the departments in which there are no employees in the department.

Explanation:
24

How to get 3 Max salaries ?

Explanation:
25

How to get 3 Min salaries ?

Explanation:
26

How to get nth max salaries ?

Explanation:
27

Select DISTINCT RECORDS from emp table.

Explanation:
28

How to delete duplicate rows in a table?

Explanation:
29

Count of number of employees in department wise.

Explanation:
30

Suppose there is annual salary information provided by emp table. How to fetch monthly salary of each and every employee?

Explanation:
31

Select all record from emp table where deptno =10 or 40.

Explanation:
32

Select all record from emp table where deptno=30 and sal>1500.

Explanation:
33

Select all record from emp where job not in SALESMAN or CLERK.

Explanation:
34

Select all record from emp where ename in 'BLAKE','SCOTT','KING'and'FORD'.

Explanation:
35

Select all records where ename starts with ‘S’ and its lenth is 6 char.

Explanation:
36

Select all records where ename may be any no of character but it should end with ‘R’.

Explanation:
37

Count MGR and their salary in emp table.

Explanation:
38

In emp table add comm+sal as total sal .

Explanation:
39

Select any salary <3000 from emp table.

Explanation:
40

Select all salary <3000 from emp table.

Explanation:
41

Select all the employee group by deptno and sal in descending order.

Explanation:
42

How can I create an empty table emp1 with same structure as emp?

Explanation:
43

How to retrive record where sal between 1000 to 2000?

Explanation:
44

Select all records where dept no of both emp and dept table matches.

Explanation:
45

If there are two tables emp1 and emp2, and both have common record. How can I fetch all the recods but common records only once?

Explanation:
46

How to fetch only common records from two tables emp and emp1?

Explanation:
47

How can I retrive all records of emp1 those should not present in emp2?

Explanation:
48

Count the totalsa deptno wise where more than 2 employees exist.

Explanation:
49

Query to find second highest salary of Employee

Explanation:
50

Find nth maximum salaries

Explanation:
51

Fetch ALTERNATE records from a table. (EVEN Numbered)

Explanation:
52

Select First n records from a table

Explanation:
53

Select Last n records from a table

Explanation:
54

Delete Duplicate Rows in a table

Explanation:
55

Count MGR and their salary in employee table

Explanation:
56

Add comm+salary as total salary

Explanation:
57

Retrieve record from salary between 1000 to 2000

Explanation:
58

Retrieve department-wise totalsalary for departments with more than 2 employees

Explanation: