-
SQL - Find top two salary for each department
1. top 2 salary in each dept2. 2nd maximum sal in each dept3. 2nd minimum sal in each dept.
-
Sql query to obtain 2nd highest mark in each subject for a student
Given a table with 3 columns StudentName,Subject and Marks.Write a sql to retrieve second highest Marks Obtained for each student.
-
Query to find the list of employees age > 30
Write a query to find the list of employees whos age is greater than 30 or so given a date of birth column
-
SQL Query to find out the Maximum marks for each subject
Students table contains studentid, subjectid and marks. Where there are 10 subjects and 50 students. what is the Query to find out the Maximum marks obtained in each subject.
-
Find second lowest salary from emp table
Display the second lowest salary from emp table without using min & all
-
How to list employees names hired AFTER a certain date
I need to list the employees hired after any random date, lets say 10th December 2010 in ascending order and minus their salary by 100% how would I do this?
-
-
-
Use of VIEW
Describe use of VIEW in SQL Server?
-
What is the value of comm and sal after executing the following query if the initial value of ‘sal’ is 10000?
UPDATE EMP SET SAL = SAL + 1000, COMM = SAL*0.1;sal = 11000, comm = 1000
-
Question on Constraints
I am new to Oracle. I have created one table in that one column name salary, while creating the table I have given the datatype for that column is varchar2 and also I have given not null constraint. Now I want to change the datatype varchar2 to number, Is it possible to alter the datatype when having constraint in table?
-
How to retrieve a second highest salary from a table?
How to retrieve a second highest salary from a table?
Note:Suppose salaries are in duplicate values
eg:
Name Sal
Malli 60000
Pandi 60000
Rudra 45000
Ravi 45000
-
Find the Latest Salary of each Employee in Employer table
How to find the latest salary of each employee in the Employer table?
emp.id sal year month
1001 5000 2015 3
1001 3000 2014 4
1002 4000 2013 3
1003 2000 2013 2 -
Alternative NULL values
Source:
col1 col2
1 Will
2 John
3 Josh
4 Devin
Target:
col1 col2
1 Will
2 NULL
3 John
4 NULL
5 Josh
6 NULL
7 Devin
8 NULL
I want the SQL query for the... -
Display Column as Rows
There is a table T with two columns C1 and C2.
The data is as below:
C1 C2
1 4
2 5
3 6
display the result as :
1 2 3
4 5 6 -
Query to Display Employee Hike Details
EID ENAME SAL SALMONTH
101 xyz 100 Jan 2015
101 xyz 200 Feb 2015
102 Abc 300 Feb 2015
I want output like this
Eid Ename hike
101 xyz 100
102 Abc 0 -
Reverse Duplicate
How to delete reverse duplicate in oracle.
e.g i/p
col1 col2
hyd blr
mum del
del blr
blr hyd
blr del
i want in o/p
col1 col2
hyd blr
mum del
del blr -
-
What is difference between Co-related sub query and nested sub query?
Co-related sub query is one in which inner query is evaluated only once and from that result outer query is evaluated.Nested query is one in which Inner query is evaluated for multiple times for gatting one row of that outer query.ex. Query used with IN() clause is Co-related query. Query used with = operator is Nested query
-
How Select query works in Oracle
When we give SELECT * FROM EMP; How does oracle respond?
SQL Interview Questions
Ans