Top MySQL Interview Questions & Answers

Top MySQL Interview Questions & Answers Collection

Here, you will find Most common MySQL queries with solutions. It is important to learn and prepare these MySQL Select, Update, Delete operations along with MySQL functions.

How to select Top 10 records in MySQL?

You can use “LIMIT” to restrict a number of records and “ORDER BY” to sort according to the specific column name.

select * from students ORDER BY student_id LIMIT 10;

Write a MySQL Query to select students with less than 50% marks.

Description:

Table name is “student” and You need to select all students whom marks are less than 50%.

idstudent_namemarks
1Amit46
2Tome78
3Robin59
4Rocky40
5Tonny55

Solution/Query:

You need to put condition in “WHERE” clause

SELECT * FROM student WHERE marks < 50

Write a MySQL Query to select students with marks between 70 and 80

Description:

Table name is “student” and You need to select all students where marks are between 70 and 80%.

idstudent_namemarks
1Amit46
2Tome78
3Robin59
4Rocky40
5Tonny55

Solution/Query:

MySQL BETWEEN Operator is used to specify range of values in condition.

SELECT * FROM student WHERE marks BETWEEN 70 and 80