I have student marks in a student table. I need second
highest mark .Then what will the query for this?
Answers were Sorted based on User's Feedback
Answer / b.bathakaraithangam,giri
select * from student where mark=(select max(mark) from
student where mark not in (select max(mark) from student))
| Is This Answer Correct ? | 2 Yes | 0 No |
select distinct mark from student_mark s
where (select count(distinct s1.mark) from student_mark s1
where s1.mark>=s.mark )=4;
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / shrikant
I have student marks in a student table. I need all record
where second highest mark .Then what will the query for this?
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / rias
Select MIN(MARK) from student where mark in (select Top 2
mark from student order by mark desc)
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / sadaq moulani
select top 1 marks from student where marks in(select
distinct top 2 marks from student order by marks desc)
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / mohammed mujahid
select MAX (EmployeeSalary) from EmployeeDetails where
EmployeeSalary in (select MAX(EmployeeSalary) from
EmployeeDetails)
Here I have changed the table name and column name plz
check it ones with student details
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / rajat kumar
select top 1 marks from student where marks <(select max(marks) from student) order by marks desc
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / kunal sain
select mark from student s
where 1=(select count(*) from student s1
where s1.mark<s.mark);
| Is This Answer Correct ? | 5 Yes | 5 No |
Answer / sanah
select top 1 marks from marks where marks
<(select max(marks) from marks) order by 1 desc
| Is This Answer Correct ? | 3 Yes | 3 No |
Answer / abhishek srivastava
select top 1 marks from (select top 2 distinct marks from
students order by marks desc)
order by marks
| Is This Answer Correct ? | 3 Yes | 3 No |
What is meant by indexing?
Which sql server table is used to hold the stored procedure scripts?
How many levels of sp nesting is possible?
Wht is SQL Injection Attack ?
Why functions are used in sql server?
What is a subquery in a select query statement in ms sql server?
What are the rules to use the rowguidcol property to define a globally unique identifier column?
What is data compression?
how many non clustered index in sql server 2008,2010,2012
What is simple indexing method?
How do I find the default sql server instance?
How to write a query with a full outer join in ms sql server?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)