Complex SQL Queries Complex SQL Queries Examples - LearnHowToCode SarkariResult.com Interview Questions and Answers LearnHowToCodeOnline
Complex SQL Queries Complex SQL Queries Examples

Complex SQL Queries Complex SQL Queries Examples

  1. Question 1. Query To Find Second Highest Marks Of A Student?
    Answer :
    Based On the Below Student table We are Written All the Queries.
    Student Table
    SELECT marks FROM Student ORDER by marks DESC limit 1, 1;
  2. 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
  3. Question 3. What Is The Query To Fetch First Record From Student Table?
    Answer :
    SELECT * from Student where id = 1;
  4. Question 4. What Is The Query To Fetch Last Record From The Student Table?
    Answer :
    SELECT * FROM Student order by id desc limit 1
  5. Question 5. What Is Query To Display First 4 Records From Student  Table?
    Answer :
     SELECT *  FROM Student limit 4
  6. Question 6. What Is Query To Display Last 3 Records From Student Table?
    Answer :
    SELECT *  FROM Student order by std_id Desc limit 3
  7. Question 7. What Is Query To Display Nth Record From Student Table?
    Answer :
    Select * from Student  where id = $n;
  8. Question 8. How To Get 3 Highest Marks From Student Table?
    Answer :
    SELECT distinct(marks) FROM Student ORDER BY marks DESC LIMIT 0,3
  9. Question 9. How To Display Odd Rows In Student Table?
    Answer :
    SELECT * FROM Student where MOD(id,2) = 1
  10. Question 10. How To Display Even Rows In Student Table?
    Answer :
    SELECT * FROM Student where MOD(id,2) = 0
  11. Question 11. How Can I Create Table With Same Structure Of Student Table?
    Answer :
    Create table std as Select * from Student;
  12. Question 12. Select All Records From Student Table Whose Name Is ‘abhi’ And ‘geethasri’.
    Answer :
    Select * from Student  where Name in(‘Abhi’ , ’Geethasri’);

About Mariano

I'm Ethan Mariano a software engineer by profession and reader/writter by passion.I have good understanding and knowledge of AngularJS, Database, javascript, web development, digital marketing and exploring other technologies related to Software development.

0 comments:

Featured post

Political Full Forms List

Acronym Full Form MLA Member of Legislative Assembly RSS Really Simple Syndication, Rashtriya Swayamsevak Sangh UNESCO United Nations E...

Powered by Blogger.