Complex SQL Queries Interview Questions Answers

  • Question 1. 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;

  • Question 2. 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

  • PL/SQL Interview Questions

  • Question 3. What Is The Query To Fetch First Record From Student Table?

    Answer :

    SELECT * from Student where id = 1;

  • Question 4. What Is The Query To Fetch Last Record From The Student Table?

    Answer :

    SELECT * FROM Student order by id desc limit 1

  • C++ Tutorial

  • Question 5. What Is Query To Display First 4 Records From Student  Table?

    Answer :

     SELECT *  FROM Student limit 4

  • C++ Interview Questions

  • Question 6. What Is Query To Display Last 3 Records From Student Table?

    Answer :

    SELECT *  FROM Student order by std_id Desc limit 3

  • Question 7. What Is Query To Display Nth Record From Student Table?

    Answer :

    Select * from Student  where id = $n;

  • MySQL Tutorial MySQL Interview Questions

  • Question 8. How To Get 3 Highest Marks From Student Table?

    Answer :

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

  • Question 9. How To Display Odd Rows In Student Table?

    Answer :

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

  • DB2 Using SQL Interview Questions

  • Question 10. How To Display Even Rows In Student Table?

    Answer :

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

  • DB2 Using SQL Tutorial

  • Question 11. How Can I Create Table With Same Structure Of Student Table?

    Answer :

    Create table std as Select * from Student;

  • SQL DBA Interview Questions

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

    Answer :

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

  • PL/SQL Interview Questions