Question Bank of MYSQL

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Question Bank

Basic

1) Explain the differences between structured data and unstructured data.


2) What is Database?
3) Example of database?
4) What are the types of DBMS?
5) What is RDBMS Model
6) What are the advantages of DBMS?
7) What is RDBMS?
8) Difference between DBMS vs File system?
9) Difference between DBMS vs RDBMS system?
10) Types of keys in RDBMS?
11) What is SQL?
12) What are the Advantages of SQL?
13) What is difference between SQL and MYSQL?
14) What is difference between SQL & PLSQL?
15) What is a Record in a database?
16) What is a database transaction?
17) What are properties of a transaction?
18) What is a Database Lock?
19) What are the type of locks ?
20) What is normalization & what are the different type of normalization?
21) What is De-normalization?
22) What is Identity?
23) What is Data Warehouse?
24) What is Data Mining?
25) What is the relationship of ODBC, OLE DB, and ADO?
26) What are dimension tables and definition of Fact tables?
27) What is SQL Schema?

TYPES OF SQL COMMANDS

1) What is the different type of SQL or different commands in SQL?


2) Define SQL Insert Statement?
3) Define SQL Update Statement?
4) Define SQL Delete Statement?
5) What is the AUTO_INCREMENT?
6) What is the difference between the “DELETE” and “TRUNCATE” commands?

DATATYPES GROUPING OPERATIONS and ALIS

1) What is difference between Char vs Varchar?


2) What is the difference between the “WHERE” clause and the “HAVING” clause?
3) What is the difference between the “GROUP BY” clause and the “ORDER BY” clause?
4) What is the difference between a “Local Temporary Table” and “Global Temporary Table”?
5) Define REMANE and Alias?
6) Difference Between Rank, Dense Rank and ROW Number?

DATABASE CONSTRAINTS & OPERATORS

1) Why do we use SQL constraints? Explain different types of constraints


2) What is the difference between “Primary Key” and “Unique Key”?
3) Why do we use SQL Operator? Explain different types of Operators in SQL
4) What is mean by Distinct, All, In, not in, Between & Like Operators?
5) What is mean by Set Operators and what are the conditions?
6) What is the difference between UNION and UNION ALL?
7) What is the difference between minus and Interact commands?
8) What are wild cards used in database for Pattern Matching?
9) What are Aggregate Functions?

Page 1 of 5 Reference ID: PDM-Document number


10) What is Join? And What are different Types of Joins?
11) What is a self-join? Explain it with an example?
12) How to implement one-to-one, one-to-many and many-to-many relationships while designing tables?
13) What is a view in SQL? How to create one
14) What are the uses of view?
15) What is a materialized view?
16) What are the advantages and disadvantages of views in a database?
17) What are clustered and non-clustered Indexes?
18) What is the difference between Cluster and Non cluster Index?
19) What is an index? What are the types of indexes? How many clustered indexes can be created on a table? I
create a separate index on each column of a table. what are the advantages and disadvantages of this
approach?
20) What are the different index configurations a table can have?

SQL Interview Questions and answers on Stored Procedures and Triggers

1) What is a Trigger?
2) What are triggers? How many triggers you can have on a table? How to invoke a trigger on demand?
3) What is a stored procedure?
4) What are the advantages of using Stored Procedures?
5) What are stored procedures, and how do they differ from triggers?
6) What is the difference between “Stored Procedure” and “Function”?
7) What is User Defined Functions? What kind of User-Defined Functions can be created?
8) What is a transaction and what are ACID properties?
9) Explain different isolation levels?
10) What's the maximum size of a row?
11) Explain Active/Active and Active/Passive cluster configurations?
12) What is lock escalation?
13) Explain the storage models of OLAP?
14) What are the steps you will take to improve performance of a poor performing query?
15) Explain CREATE DATABASE syntax?
16) Explain different types of BACKUPs available in SQL Server? Given a particular scenario, how would you
go about choosing a backup plan?
17) What is database replication? What are the different types of replications you can set up in SQL Server?
18) What are cursors?
19) What are cursors? Explain different types of cursors. What are the disadvantages of cursors? How can you
avoid cursors?
20) What are cursors? Explain different types of cursors. What are the disadvantages of cursors? How can you
avoid cursors?
21) Explain the ETL process in Data warehousing?
22) What is Data mining?
23) What is Nested Trigger?
24) What is Collation?
25) What are the properties and different Types of Sub-Queries?
26) What are different types of Collation Sensitivity?
27) What is OLTP (Online Transaction Processing)?
28) What does it mean to have QUOTED_IDENTIFIER ON? What are the implications of having it OFF?
29) What is the difference between a Local and a Global temporary table?
30) What is the STUFF function and how does it differ from the REPLACE function?
31) What are the basic functions for master, msdb, model, tempdb and resource databases?
32) What is MERGE Statement?
33) What is Filtered Index?
34) What do you mean by Table Sample?
35) What is B-Tree?
36) Explain the difference between attributes and identifiers.

Page 2 of 5 Reference ID: PDM-Document number


Queries
1. SQL Query to find Max Salary from each department
2. SQL Query to find second highest salary of Employee
3. Find the 3rd MAX salary in the emp table.
4. Find the Nth Highest salary in the emp table without TOP/Limit Keyword
5. Find the 3rd MIN salary in the emp table.
6. Write SQL Query to display current date.
7. Write an SQL Query to check whether date passed to Query is date of given format or not.
8. Write a SQL Query to find year from date.
9. To fetch ALTERNATE records from a table. (EVEN NUMBERED)
10. To select ALTERNATE records from a table. (ODD NUMBERED)
11. Select FIRST n records from a table.
12. Select LAST 3 records from a table
13. Select LAST n records from a table
14. Select DISTINCT RECORDS from emp table.
15. How to delete duplicate rows in a table?
16. find duplicates rows in Table?
17. How to get top 5 states with highest sale?
18. How to display alternate rows from a table?
19. Write a query to display workers who have joined this month?
20. Write a query to display employee name and manager name from same table?
21. Write a SQL Query to Display the first and last records from a table?
22. Count of number of employees in department wise.?
23. Suppose there is annual salary information provided by emp table. How to fetch monthly salary of every
employee?
24. Select all record from emp table where deptno =10 or 40.
25. Select all record from emp table where deptno=30 and sal>1500.
26. Count MGR and their salary in emp table.
27. Select any salary <3000 from emp table.
28. How can I create an empty table emp1 with same structure as emp?
29. How do you copy all rows of a table using SQL query?

30. Select all records where dept no of both emp and dept table matches.
31. If there are two tables emp1 and emp2, and both have common record. How can I fetch all the records but
common records only once?
32. How to fetch only common records from two tables emp and emp1?
33. How can I retrieve all records of emp1 those should not present in emp2?
34. Count the total salary deptno wise where more than 2 employees exist.
35. Select all the employee group by deptno and sal in descending order.
36. Write an SQL Query to find employee whose Salary is equal or greater than 10000
37. Display the list of employees who have joined the company before 30th June 90 or after 31st dec 90
38. How to retrieve record where sal between 1000 to 2000?
39. Write a SQL Query to print the name of distinct employee whose DOB is between 01/01/1960 to 31/12/1975.
40. Write an SQL Query find number of employees according to gender whose DOB is between 01/01/1960 to
31/12/1975.
41. Select all record from emp where ename in 'BLAKE','SCOTT','KING' and 'FORD'.
42. Display the names of employees working in department number 10 or 20 or 40 or employees working as
clerks, salesman or analyst.
43. Select all record from emp where job not in SALESMAN or CLERK.
44. List dept no., Dept name for all the departments in which there are no employees in the department.
45. Display the names of employees whose name starts with alphabet S.
46. Display employee names for employees whose name ends with alphabet.
47. Select all records where ename starts with ‘S’ and its lenth is 6 char.
48. Select all records where ename may be any no of character but it should end with ‘R’.
49. Write an SQL Query to find name of employee where ‘M’ in any position
50. find all Employee records containing the word "Joe", regardless of whether it was stored as JOE, Joe, or joe.
51. Write an SQL Query to show all first name in capital and last name in small letter with alias?
52. Write an SQL Query to show empid, first name and salary where salary of an employee more than average
salary

Page 3 of 5 Reference ID: PDM-Document number


53. Write an SQL Query to show 5% of increment in salary as new salary?
54. Write an SQL Query to update 5% of increment in salary
55. Write an SQL Query to show records in which department count of employee is more than 1
56. Write an SQL Query to show records where employee salary is greater than his manager salary?
57. Write an SQL Query to show Odd/Even status on the basis of 1st digit of amount?
58. Fetch the top 3 record in each category in terms of total sale?
59. Write a SQL query to find the name of the department where more than two employees working.
60. Write an SQL Query to retrieve the first 4 character of employee name from the emp table.
61. Write query to fetch all the records from employee_info table order by department in assending order and
salary in descending order
62. Write query to fetch 50% of records from the empinfo table
63. Write sql query to retrieve minimum and maximum salary
64. Write a query to fetch emp name and replace the space with ‘-‘

Page 4 of 5 Reference ID: PDM-Document number


Page 5 of 5 Reference ID: PDM-Document number

You might also like