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%.
id | student_name | marks |
---|---|---|
1 | Amit | 46 |
2 | Tome | 78 |
3 | Robin | 59 |
4 | Rocky | 40 |
5 | Tonny | 55 |
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%.
id | student_name | marks |
---|---|---|
1 | Amit | 46 |
2 | Tome | 78 |
3 | Robin | 59 |
4 | Rocky | 40 |
5 | Tonny | 55 |
Solution/Query:
MySQL BETWEEN Operator is used to specify range of values in condition.
SELECT * FROM student WHERE marks BETWEEN 70 and 80