Knowee
Questions
Features
Study Tools

We have following relationEMP(empo,ename,jobtitle,manager_no,hiredate,salary,deptno)DEPT (deptno, dname,location)1) Find employees whose name start with letter A or letter a.2) Find the employees who are working in smith's department.3) Display employees who are getting maximum salary in each department

Question

We have following relationEMP(empo,ename,jobtitle,manager_no,hiredate,salary,deptno)DEPT (deptno, dname,location)1) Find employees whose name start with letter A or letter a.2) Find the employees who are working in smith's department.3) Display employees who are getting maximum salary in each department

🧐 Not the exact question you are looking for?Go ask a question

Solution

  1. To find employees whose name starts with letter A or a, you can use the SQL LIKE operator. Here is the SQL query:
SELECT * FROM EMP
WHERE ename LIKE 'A%' OR ename LIKE 'a%';
  1. To find the employees who are working in Smith's department, you need to first find out which department Smith works in, and then find all employees in that department. Here is the SQL query:
SELECT * FROM EMP
WHERE deptno = (SELECT deptno FROM EMP WHERE ename = 'Smith');
  1. To display employees who are getting maximum salary in each department, you can use the SQL MAX function along with GROUP BY. Here is the SQL query:
SELECT deptno, MAX(salary) 
FROM EMP
GROUP BY deptno;

Please note that these queries assume that the names of your employees are stored in the 'ename' column, the department numbers are stored in the 'deptno' column, and the salaries are stored in the 'salary' column. If your table uses different column names, you will need to adjust the queries accordingly.

This problem has been solved

Similar Questions

we have following relationsEMP(empno, ename, jobtitle, manager, hiredate, salary, deptno)DEPT(deptno, dname,location)Answer the following queries .1) Find the Employees who get salary more than Chris salary.2) Display department number along with the number of employees which belongs to thatdepartment number

we have following relations:employees(emp_id, name, dept_id, city, DOJ)salaries (emp_id, salary)1) Find out the names of employees who belong to the same department as John.2) Find out names of employees whose salaries are greater than average salary.3) Retrieve the names of employees who have corresponding entries of the salary.

We have following relations:employees(emp_id, first_name, last_name, email, salary, dept_id)departments(dept_id, dept_name, location_id)(1) Find the employee who is getting second highest salary.(2) Display all the employee name along with department name who are working neitherin ‘Marketing’ Department nor earns more than 75000

For given relation:Employee(eid, ename, address,deptname ,salary)Project(eid, pid, pname, location)(1) Display name and salary of employee who is taking maximum salary.(2) Display highest salary department wise and name of employee who is taking thatsalary.(3) Find details of employee who works on a pid equal to 10

Find the following table EmployeeDetails, with the attributes EmployeeID, EmpName, Designation, Salary, DeptNo. You are assigned to a task of providing the solution to the operations department by writing the query which displays the employeeID and the Designation of all the employees whose Salaries are more than the Salary of employees designated as ManagerC

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.