Create the following tables

Page 1

1. Create the following tables: Emp_pers(eno, ename, gender, dob, address, email)

mp_sala(eno, basic_pay, epf, tax, hra,deptid)


Emp_dept(deptid, deptname)


Do the followings by using SQL queries: 1. List the employee names and their basic salary SELECT ename, basic_pay from Emp_pers A, Emp_sala B where A.eno=B.eno


2. Select the employee number, employee name and their department name SELECT A.eno, ename ,deptname FROM Emp_pers A,Emp_sala B,Emp_dept C WHERE A.eno=B.eno AND B.deptid=C.deptid


3. List the employee names and their basic salary and their department id SELECT ename,basic_pay,B.deptid FROM Emp_pers A,Emp_sala B,Emp_dept C WHERE A.eno=B.eno AND B.deptid=C.deptid


4. List the employee names and their basic salary that those are getting more than 5000 SELECT ename,basic_pay FROM Emp_pers A,Emp_sala B WHERE A.eno=B.eno AND basic_pay>5000


5. Select the employee names that those are from China SELECT ename,address FROM Emp_pers WHERE address like'*CHINA*'


6. List the employee names that those pay the tax more than RM250 SELECT ename,tax FROM Emp_pers A,Emp_sala B WHERE A.eno=B.eno AND tax>250


7. List the female employee names that those are working in Human resources department SELECT ename,gender,deptname FROM Emp_pers A,Emp_sala B,Emp_dept C WHERE A.eno=B.eno AND B.deptid=C.deptid AND gender like'*F*' AND deptname like'*Human resource department*'


8. List the employee details that those are getting RM 500 and above for House Rent Allowances SELECT A.eno,ename,gender,dob,address,email,hra FROM Emp_pers A,Emp_sala B WHERE A.eno=B.eno AND B.hra>500


9. Select the employee names that those are pay EPF more Than RM 500 SELECT ename,epf FROM Emp_pers A,Emp_sala B WHERE A.eno=B.eno AND B.epf>500


10. List the male employee names that those are working in Human resources department with salary RM 3000 and above. SELECT ename,gender,basic_pay,C.deptname FROM Emp_pers A,Emp_sala B,Emp_dept C WHERE A.eno=B.eno AND B.deptid=C.deptid AND gender like'*M*' AND C.deptname like'*Human resource department*' AND basic_pay>3000


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.