SQL Assignment 2
SQL Assignment 2
Q1: Create a new user making “your_name” as user-name and “your_surname” as the password.
Q4: Create a table employee with attributes emp_id, f_name , l_name , job_type, salary, commision,
dept, and manager_id.
Q7: Create a new table department with attributes d_name, d_loc, and hod_id.
Q8: Create another table named location with attributes loc_id, city and contact_no.
LOC_ID ADDRESS
1 kolkata
2 mumbai
Q22: Show the employee’s first name, last name, current salary and the salary with a 1000 rupees bonus.
Q23: Show the employee’s annual salary with a 1000 rupees yearly bonus and the annual salary with a
100 rupees monthly bonus.
Q24: Show f_name as Name and annual salary as ANNSAL from the employee table.
Q25: Show the L_name as SurName and 100 rupees incremented salary as NewSal from the employee
table.
Q26: Display the employees f_name and l_name joined together using the concatenation operator.
Employees Details
---------------------------------------------------------
……..
……..
Q29: Show the monthly salary details in the following fassion:
--------------------------------------------------------------------------------
………
Q31: Show the distinct department names from the employee table.
Q33. Show the employee’s id’s who are not working under manager id-1.
Q34: Show the employee’s names and salaries whose salary ranges between 40000 to 70000.
Q36: Select the first names and salaries of those employee whose last name is khan.
Q37: Select the first names and salaries of those employee whose last name starts with k.
Q38: Select the first name, last name and salary of those employee whose last name starts with k and
ends with r.
Q39: Select the employees whose 3rd letter of their last name is o.
Q40: Select the employees who are not working under any manager.
Q41: Select the employees who work as engineers with salary greater than 50000.
Q42: Select the employees who work in the production department or earns more than 60000.
Q43: Select those employees who are not managers or engineers or clerks.
Q44: Select the employees who earns more than 49000 or less than 29000.
Q45. Select the employees who don’t have an ‘o’ as the 2nd last letter of their last name.
Q48. Show the total experience in weeks for all the employees.
Q50. Delete the employees from sales department if they are not working as managers.
Q51. Insert the following two rows in the employee table without inserting any value in the department
field.
EMP_ID F_NAME L_NAME JOB_TYPE SALARY COMMISION D_NAME MANAGER_ID DOJ
Admin Mumbai 5
Transport Mumbai 3
Q53. Update the employee table. Assign Anand to the admin department.
Q57. Delete the employees who are working as salesmen and having less experience than 15 years.