-
-
-
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 -
What command is used to create a table by copying the structure of another table?
Answer :CREATE TABLE .. AS SELECT commandExplanation : To copy only the structure, the WHERE clause of the SELECT command should contain a FALSE statement as in the following.CREATE TABLE NEWTABLE AS SELECT * FROM EXISTINGTABLE WHERE 1=2;If the WHERE condition is true, then all the rows or rows satisfying the condition will be copied to the new table.
-
-
-
-
-
How to retrieve the 2nd record from a table ?
How to retrieve the 2nd record from a table which has say 1000 records in it. Please answer this without using the row-id? I tried to say a query "select * from table where rowcount=1" which worked well and also "select * from table where rowcount=3" which gave me the result but not when I did the same query "select * from table where rowcount=2" ? why?
-
-
How to change the column name by using ALTER?
I Tried by giving......................... ALTER table table name rename column tocolumn name was changed but it's not giving entire table with altered column name.It's giving only the altered column.
-
-
Difference between joins and subquery?
Why do we use joins, instead subquery has same operation?
-
Display the employee details who joined before 5 days.
Write a query to display the employee details who joined before 5 days.
-
Query to Get Highest Marks Output
Question: student marks stable "sp_report"
sid maths chem phy engl
1 33 45 54 48
2 55 32 50 37
3 10 20 30 40
The required o/p is (SQL QUERY TO GET THE BELOW O/P)
sid highest_marks
1 54
2 55
3 40
-
Which is the subset of SQL commands used to manipulate Oracle Database structures, including tables?
Data Definition Language (DDL)
-
-
What is table space?
I want to know the answer
-
How to display duplicate rows in a table?
Select * from emp where deptno=any(select deptno from emp having count(deptno)>1 group by deptno);
-
What is Dual table?
What is dual table which is used as a table in sql...
SQL Interview Questions
Ans