1) Reverse a string
import java.util.*; public class MyClass { public static void main(String args[]) { // int x=10; // int y=25; // int z=x+y; Scanner sc=new Scanner(System.in); String st="maneesh",res=""; for(int i=st.length()-1;i>-1;i--){ res+=String.valueOf(st.charAt(i)); } System.out.println("String = " + res); } }
3) Bubble Sort
Sql
1) Write a query to display max salary from employee table
Select max(salary) from Employee
2) Write a query to display 2nd max salary from employee table
Select max(salary) As s from Employee
where s< (Select max(salary) from Employee)
2nd way
SELECT salary
FROM employee
ORDER BY salary desc limit n-1,1
Comments
Post a Comment