Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

Select All Records From Student Table Whose Name Is ‘abhi’ And ‘geethasri’.

Answer»

SELECT * from STUDENT where NAME in(‘ABHI’ , ’Geethasri’);

Select * from Student where Name in(‘Abhi’ , ’Geethasri’);

2.

How Can I Create Table With Same Structure Of Student Table?

Answer»

CREATE table STD as SELECT * from STUDENT;

Create table std as Select * from Student;

3.

How To Display Even Rows In Student Table?

Answer»

SELECT * FROM STUDENT where MOD(id,2) = 0

SELECT * FROM Student where MOD(id,2) = 0

4.

How To Display Odd Rows In Student Table?

Answer»

SELECT * FROM STUDENT where MOD(id,2) = 1

SELECT * FROM Student where MOD(id,2) = 1

5.

How To Get 3 Highest Marks From Student Table?

Answer»

SELECT distinct(marks) FROM STUDENT ORDER BY marks DESC LIMIT 0,3

SELECT distinct(marks) FROM Student ORDER BY marks DESC LIMIT 0,3

6.

What Is Query To Display Nth Record From Student Table?

Answer»

SELECT * from STUDENT where ID = $N;

Select * from Student where id = $n;

7.

What Is Query To Display Last 3 Records From Student Table?

Answer»

SELECT * FROM Student ORDER by std_id DESC limit 3

SELECT * FROM Student order by std_id Desc limit 3

8.

What Is Query To Display First 4 Records From Student Table?

Answer»

 SELECT * FROM STUDENT LIMIT 4

 SELECT * FROM Student limit 4

9.

What Is The Query To Fetch Last Record From The Student Table?

Answer»

SELECT * FROM Student ORDER by ID desc limit 1

SELECT * FROM Student order by id desc limit 1

10.

What Is The Query To Fetch First Record From Student Table?

Answer»

SELECT * from STUDENT where ID = 1;

SELECT * from Student where id = 1;

11.

Query To Find Duplicate Rows In Table?

Answer»

SELECT std_id, COUNT(std_id) as cnt FROM STUDENT GROUP by std_id having cnt > 1

SELECT std_id, COUNT(std_id) as cnt FROM Student GROUP by std_id having cnt > 1

12.

Query To Find Second Highest Marks Of A Student?

Answer»

Based On the Below STUDENT table We are Written All the Queries.

SELECT MARKS FROM Student ORDER by marks DESC limit 1, 1;

Based On the Below Student table We are Written All the Queries.

SELECT marks FROM Student ORDER by marks DESC limit 1, 1;