Employee Ename Anil Shankar Jaya Sunil Vijay Prakash Ajay Nagpur Bombay Madras Bombay Delhi Calcutta
Emp_company Ename Anil Shankar Jaya Sunil Vijay Prakash Ajay Amol
Ename Acc Tata Cmc Cmc Tata Tata Acc Acc Company City Madras Bombay Nagpur Bombay Madras delhi Manager Ename
Salary 1500.00 2000.00 1800.00 1700.00 5000.00 3000.00 8000.00 1000.00
Jdate 01-may-89 10-jul-90 07-jun-91 01-jan-88 03-jan-88 27-may-89 30-apr-95 17-may-95
Cname Acc Tata Acc Cmc Cmc Tata
Mname Ajay Vijay Jaya Shankar Emp_shift
Anil Shankar Jaya Sunil Vijay Prakash Ajay
Ename Anil Sunil Vijay A B B
cname.road Andheri Virar Nehruplace Powai 1000 5000 3500 1200 3000 2000 1000 5000 7000 Amount Adate 01—mar-95 4-jan-96 17-Nov-95 17-dec-95 27-mar-96 31-mar-96 5-sep-95 02-jul-95 10-aug-95
Branch City Nagpur
. retrieving the name of the company located in the city ‘BOMBAY’ Alias : 1. Actno 100 101 102 104 105 106 107 108 109 Cname Anil Sunil Mehul Madhuri Pramod Sandip Shivani Kranti Naren Deposit Bname Vrec Ajni Karolbagh chandni m. using describe command 2. Create tables according to the following definition.
1.g.salary.Prakash 1. Set Operator : 1. getting the cities of companies ACC and TATA 2. city 5. getting information only ename. getting information only cname. get the data from emp_company
g.Ajni Karolbagu Chandni Dharampeth m.road Andheri Virar Nehru place Powai
Nagpur Delhi Delhi Nagpur Banglore Bombay Bombay Delhi Bombay
Cname Anil Sunil Mehul Mandar Madhuri Pramod Sandip Shivani Krinti Naren
Cutomer City Calcutta Delhi Baroda Patna Nagpur Nagpur Surat Bombay Bombay bombay
Loanno 201 206 311 321 375 481
Cname Anil Mehul Sunil Madhuri Pramod Kranti
Borrow Bname Vrce Ajni Dharampeth Andheri Virar Nehru place
Amount 1000 5000 3000 2000 8000 3000
Selecting data from single table :
1. list all data from table deposit
loan amount. give loadno. branch name. give names of depositors having the same branch as the branch of sunil 8. give account number and amount of depositors 6. give names of depositors having the same living city as that of shivani and having deposit amount greater than 2000 6. give name of customers having the same living city as their branch city 3. give names of customers living in city nagpur 11. account no and deposit amount of customers living in city nagpur 12. give loanno. give loanno and loan amount of barrowers having the same branch as that of depositor sunil 11. give name of all branches located in city delhi 17. give names of customers who opened account after date ‘1-12-95’ 18. list all data from table barrow 3. deposit amount. give name of borrower having load no 206 15. give deposit details and loan details of customer in the city where Promod is living
. load amount. give names of all branches located in city Bombay 14. list all data from table customer 4. branch city and living city of Pramod 14. give loadno. give names of borrowers having loan amount greater than the loan amount of anil 9. give details of customer anil Join or Cartesian product : 1. give name of customers 8. give names of depositors having amount greater than 4000 12. give names of customers who are borrowers as well as depositors and having living city nagpur 4. give name of customer having living city Bombay and branch city delhi 2. give name of the city where branch karolbagh is located 20. give name of depositors having account at vrce 16. account no and deposit amount of customers having deposit branch located in delhi 13. give names of barrowers 10. account no. give account number and deposit amount of customer having account opened between dates 1-12-95 and 1-6-95 19. give cname and account number of depositors 7. give account date of customer anil 13. loan amount. give names of borrowers having deposits amount greater than 1000 and loan amount greater than 2000 7. give names of customers living in the city where branch of depositor sunil is located 10. list all data from branch 5. give names of customers who are depositors and have the same branch city as that of sunil 5. give names of branches 9.2.
List total loan 2. list the branches having sum of deposit more than 4000 2. give branchwise load of customer living in nagpur 16. give names of depositors having amount greater than 1000 and having the same living city as Pramod 17. give the number of customers who are depositors as well as borrowers Group by and Having Clause : 1. list total deposit of customer living in city nagpur 6. list total deposit of customers living in the city where sunil in living 9. give living citywise load of borrowers 20. give branch city and living city of Promod 19. count total number of customers 17. give the branchwise deposit of customer after account date 01-jan-96 15. give names of depositors having the same branch city as that of sunil and having the same living city as that of anil 16. list the names of customers having deposit in the branches where the average deposit is more than 1000
. give maximum load from branch vrce 19. give city of customer having the same branch city as that of promod 18. List total loan taken from ANDHERI branch
4. List total deposit of customer having account date later than 01-jan-96 5. list the branches having a sum of deposit more than 1000 and located in city BOMBAY 3. List total deposit
3. give the living city of anil and the living city of sunil
Aggregate funcations : 1. count total number of customer cities 11. list total deposit of customers having branch city DELHI 8. give branch name and branchwise deposit 12.15. count total number of branch cities 10. count total number of depositors branchwise 18. give branch city of a sunil or branch city of anil 20. give cityiwise name and branchwise deposit 14. list maximum deposit of customers living BOMBAY 7. give city name and citywise deposit 13.
list the name of customers having maximum deposit in the customers living in NAGPUR 6. give the name of branch where number of depositors is less than 2 15.4. give names of customers in KAROLBAGH branch having more deposit than any other customer in VIRAR branch 10. list the name of branch having highest number of depositors 7. give the names of cities in which the maximum number of branches are located 18. give 10% interest to all depositors living in NAGPUR and having branch in city BOMBAY 5. count the number of customers living in city where branch is located Update Statements : 1. give names of customers having maximum deposit amount deposits of NAGPUR for branch VRCE 14. give the names of borrowers having the same branch city and highest borrower 20. give 10% interest to all depositors 2. assign to the deposit of ANIL the maximum deposit from VRCE branch 8. change the living city of VRCE branch borrowers to NAGPUR 9. change the deposit of VRCE branch to 1000 and change the branch as VRCE_AMBAZARI 7. add hundred rupees to the deposit of ANIL and assign it to SUNIL 6. transfer Rs 10 from the account of MADHURI to the account of PRAMOD if both are living in the same city 15. give the highest deposit of the city where branch of sunil is located 12. count the number of depositors living in NAGPUR 8. give 10% interest to all depositors living in NAGPUR 4. give name of city having more customers living in than NAGPUR 16. give names of customers having highest deposit in the branch where sunil is having deposit 11. give names of branches having the number of depositors more than the number of borrowers 17. transfer Rs 10 from the account of ANIL to the account of SUNIL if both are having the same branch 13. transfer Rs 10 from the account of ANIL to the account of SUNIL 12. transfer Rs 10 from the account of ANIL to the account of SUNIL if both are having the same branches
. list the names of customers having maximum deposit 5. give names of customers having more deposit than the average deposit in their respective branches 13. transfer Rs 10 from the account of MADHURI to the account of PRAMOD if both are living in NAGPUR 14. give names of customers in POWAI branch having more deposit than all customer from VRCE branch 9. update deposit of ANIL give him maximum deposit from depositors in living city NAGPUR 10. deposit the sum of the deposits of SUNIL and VIJAY in the account of ANIL 11. give 10% interest to all depositors living in NAGPUR 3. give the names of customers living in the city where the maximum number of depositors are located 19.
delete deposit of VIJAY 11. delete branches having average deposit less than 5000 4. delete borrower of branches having the minimum number of customers Set operators : 1. list all the depositors living in city NAGPUR 7.16. add Rs 10 to the amount of all depositors having deposit higher than the average deposit of their branch 19. delete customers from BOMBAY city 13. delete depositors if the branch is VIRAR and depositor name is AJAY 14. list all the customers living in city NAGPUR and having branch city BOMBAY or DELHI 6. delete deposit of ANIL and SUNIL if they are having less deposit than VIJAY 10. delete borrower having branch name CHANDHI 19. delete borrower having loan more than 1000 and branch KAROLBAGH 17. delete deposit of ANIL and SUNIL if both are having branch VIRAR 7. delete deposit of AJAY if VIJAY is not a depositor 12. list all the depositors having deposit in all the branches where SUNIL is having account 5. list all the customers along with their amount who are either borrowers or depositors and living in city NAGPUR 4. add Rs 10 to the amount of all depositors having deposit higher than the average deposit 18. delete branches having deposit from NAGPUR 6. delete from customer 2. delete deposit of ANIL and SUNIL if both are having the same living city 9. delete borrower of branches having average loan less than 1000 20. list all the customers who are both depositors and borrowers 3. delete deposit of ANIL and SUNIL if both are having living city NAGPUR 8. delete depositors of branches having number of customers between 1 and 3 3. add Rs 10 to the amount of all customers living in the city where their branch is located 20. add Rs 100 to the account of all those depositors who are having the highest deposit amount in their respective branches 17. delete borrower having loan more than 10000 16. delete branches having maximum loan more than 5000 5. list all the customers who are depositors but not borrowers 2. delete the names of those depositors of VRCE branch who live in the city BOMBAY 18. add Rs 10 to the amount of all depositors having deposit higher than the average deposit of their branch Delete Statement : 1. delete depositors having deposit less than 500 15. list all the depositors living in NAGPUR and having branch in city DELHI
list the depositors having the same living city as that of SUNIL and the same branch city as that of ANIL
13. (CASE shift When ‘A’ then ‘A-SHIFT’ When ‘B’ then ‘B-SHIFT’ When ‘C’ then ‘C-SHIFT’ ELSE ‘ANY_SHIFT’
. list all the customers who are both depositors and borrowers and living in the same city as ANIL 15. list the customers who are borrowers or depositors and having living city BOMBAY and branch city same as that of SANDIP 20. list the customers who are both borrowers and depositors and having the same branch city as that of ANIL Scalar Subquery In select clause : 1. list the customer having deposit greater than 1000 and loan less than 10000 10. list all the customer names and the AMOUNT for depositors living in the city where either ANIL or SUNIL is living 17. list the depositors having amount less than 8000 and living in the same city as Ms. SHIVANI
14. list the amount for the depositors living in the city where ANIL is living 18.. list the borrowers having branch city same as that of SUNIL 11. list the cities of depositors having branch VRCE 12. displaying employees ordered by maximum salary in their company Simple Case Statement : Ename Anil Shankar EMP_SHIFT Shift A B C D
Using case . list the cities which are either branch city of ANIL or living city of SUNIL 19. else Select ename.. when . list all the cities where branches of ANIL and SUNIL are located 16. comparing the salary of employee with the maximum salary of employee in that company Use of scalar subquery in where clause :
1. Display names of employees having maximum salary in his company
Use of scalar subquery in order by clause : 1.8. list the branch cities of ANIL and SUNIL 9.
Query’s based on operators : 1. total .ename. Display the details of all the employees joined on 17-nov-1981 . Display the details of blake. Display empno. da. Display empno.ename. Display empno. Display the employees whose experience more than 26 years 10. gross salary. Display the employee details working for the deptno 30 ? in the desc order by job
13. current date. joining date. john’s adams. experience show in years of all employees in desc of experience 4. ename. current date. experience of all employees in desc of experience
3. Display details of ename of scott 7. and killer 16.END) as Shift_Name FROM Emp_Shift. Display the details of all the employee receiving a daily salary less then 50
11. ta. (CASE WHEN shift < ‘C’ THEN ‘MORNING_SHIFT’ WHEN shift < ‘D’ THEN ‘MORNING_SHIFT’ ELSE ‘NIGHT_SHIFT’ END) AS SHIFT_NAME FROM EMP_SHIFT. sal . 03-dec-1981. Searched Case Statement : SELECT ENAME. joining date.annual sal. Display all the analysts & Managers 15. Display all the employees joined before 1st –MAY-194
14.ename. Display all the details with experience > 26
12. hra. king. Display empno. list the employees whose joined after year 98 9. list the employees whose sal is more than 2500 8. daily sal from all employees in the descending order of daily salary ?
2. james. Display the details of all the employees whose salary is ranging from 1500 to 3250 (write 2 methods )
. 09-jun-1981 17. Display the details of clerks 6. of all the employees in desc order of gross salary 5.
Display all the 5 character names begin with ‘S’ 25. Display all 6 charactered named employees
42. Display the details of all the employees receiving no comm. ename. sal or comm. sal daily sal. 34. Display the details off all the employees joined after 2nd quarter of 1982
23. Display all the even number salaries 41.. Display all the names having character ‘A’ 26. sal. Which even in high sal or comm. rounded to the nearest integer annual sal rounded to the nearest
100. Display the details of all 4 digits salary employees 29.u in the 3rd position of name 44. Display the details of all the manages of dept 10. 21. Display empno. comm. Display the details of all the employees of dept 10 & 20 joined before 1983. experience with 2 decimal places of all the employees 37. Display the details of all the employees along with daily sal of those receiving a dsal without any decimal places
38. 39. Display all the table names of having space character in the name 32.e. Display all enames having a char eighter a. In the desc order of hiredate 35. Display empno. sal.
22. Or who belongs to dept 30 working as salesman with sal more than 800 joined in the year 1981 & name of the employee not starts with character ‘A’ in the ascending order of deptno
36. Display all the salesman of deptno 30 receiving some comm.I. Display the details of all the employees receiving the comm. Which ever is low
for all the employees. Display the emp names those are starting with ‘S’ and 5 characters length and 3rd character is ‘O’ and
last character is ‘T’
43. Display all the table names of having percentile character in the name 31.18.o. Display the details of manager along with exp of those having ranges from 26 to 27 20.20. Display all the table names having a character underscore in the name 30. List all the employees joined in month which started with character ‘A’ 28. dailysal. of all employees in the descending
order of their daily salary
. ename. Display all the salaries those are divisible by 1000 40.ename. with sal more than 1300 & less than 3500 and not belongs to the month December working under some manager with out comm. Display the details of all analyst having exp more than 25 years receiving a salary which is more than 2000 & not receiving any comm. Display empno.30 33. Display all 4 character names 24. List all the names ending with character ‘N’ 27. Display the details of all the employees in desc order of their salary of those joining in the year 1981 19.
rpad. Display details of employee in the descending order of their salaries 2. <value>) this function required 2 parameters This function works on any datatype. job of all employees descriptive line headings (use “as” also) Order by clause : sorting the output (default sort order is asc / desc) Syntax : 1. Display details of employees if current day of month is lessthan 15 then consider the total days of lastmonth otherwise totaldays of present month Lpad. Display all the commission in descending order NVL( ) : null value conversion Nvl ( ) is to replace the null value with specified not null value Nvl(<col>. both parameters along with datatype Decode( ) : Decode works on any datatype but all parameters should belongs to same datatype 9i Extrace (day from sysdate) : Case( ) : 1. Ltrim. of all the employees in the ascending order of deptno & in desc order
of job (1. empno. job. sal. rtrim.2) 4.Projection : Retrieving the data from the specific columns of table is called projection Alias : means giving a temporary heading to column during the data display is called columns alias 1. Date converssion functions
. ename. Display details of employee in the descending order of their experience
3. Display all the unique jobs in ascending order 5. Display deptno. Display empno. sal . trim.