Professional Documents
Culture Documents
Examples
Examples
*****************
--get ename, sal based on salary order?
select ename,sal from emp_info
order by sal;
--Order the data based on desg and under each desg order data based on sal?
--Get emp names and gender values based on gender order and under each gender
--order the emp names?
select gender,ename
from emp_info
order by gender,ename;
select eid,sal,jdate
from emp_info
order by 3;
--Find the highest account balance from the account type "SB"?
select max(act_bal)
from cust_act_dtls
where act_type='SB';
--Get job name and min sal and max sal from each job category?
--Display deptno,count of emps from each job category under each dept
--and also we need at least 2 emps from a job category?
select deptno, job, count(*) "count"
from emp
group by deptno,job
having count(*)>=2
order by deptno;
AGGREGATE EXAMPLES:-
Ex: Find the sum of salaries of emps working under RESEARCH department?
Ex: Find the total investment amount for the products from sony?
Ex: Find the total balance from the account types SB and SAL?
-----------------------------------------------------------------------------------
--------
INTERVIEW QUESTIONS
A:
ALTER TABLE <name>
MODIFY col datatype(size) NULL;
3) How to find out length of user name from any mail id?
45) What is the difference between Inner join and Left outer Join?
46) Assume , that there are no constraints on tables, but there is a common
column. Then are you able to write JOIN condition?
59) How to convert gender column values like "Males into Females"
and "Females into Males"?
60) How do i search for the values having a character either "_"(under score)
or "%"?
61) Can we enable a constraint , even the column having invalid data?
If Yes, How?
If no , Why?
62) What is the use of alias names of tables?
A: MERGE
-----------------------------------------------------------------------------------
-------