SQL
SQL
Table : JOB
1. To display employee ids, names of employees, job ids with corresponding job
titles.
2. To display names of employees, sales and corresponding job titles who have
achieved sales more than 1300000.
3. To display names and corresponding job titles of those employees who have
'SINGH' (anywhere) in their names.
4. Identify foreign key in the table EMPLOYEE.
5. Write SQL command to change the JOBID to 104 of the EMPLOYEE with ID
as E4 in the table 'EMPLOYEE'.
1
Question 12
Consider the following tables Employee and Salary. Write SQL commands for
the statements (i) to (iv) and give outputs for SQL queries (v) to (vii)
Table : Employee
Table : Salary
Question 13
With reference to following relations PERSONAL and JOB answer the questions
that follow :
Create following tables such that Empno and Sno are not null and unique, date
of birth is after '12-Jan-1960', name is never blank, Area and Native place is
valid, hobby, dept is not empty, salary is between 4000 and 10000.
Table : Personal
Table : Job
3
Sno Area App_date Salary Retd_date Dept
(a) Show empno, name and salary of those who have Sports as hobby.
(b) Show name of the eldest employee.
(c) Show number of employee area wise.
(d) Show youngest employees from each Native place.
(e) Show Sno, Name, Hobby and Salary in descending order of Salary.
(f) Show the hobbies of those whose name pronounces as 'Abhay'.
(g) Show the appointment date and native place of those whose name starts
with 'A' or ends in 'd'.
(h) Show the salary expense with suitable column heading of those who shall
retire after 20-jan-2006.
(i) Show additional burden on the company in case salary of employees having
hobby as sports, is increased by 10%.
(j) Show the hobby of which there are 2 or more employees.
(k) Show how many employee shall retire today if maximum length of service is
20 years.
(l) Show those employee name and date of birth who have served more than 17
years as on date.
(m) Show names of those who earn more than all of the employees of Sales
dept.
(n) Increase salary of the employees by 5 % of their present salary with hobby
as Music or they have completed atleast 3 years of service.
(o) Write the output of :