Write queries for the following tables:T1 ( Empno, Ename , Salary, Designation)T2 (Empno, Deptno.)(1) Display the Deptno in which Employee Seeta is working.(2) Display Empno, Ename, Deptno.
Question
Write queries for the following tables:T1 ( Empno, Ename , Salary, Designation)T2 (Empno, Deptno.)(1) Display the Deptno in which Employee Seeta is working.(2) Display Empno, Ename, Deptno.
Solution
(1) To display the Deptno in which Employee Seeta is working, you can use the following SQL query:
SELECT T2.Deptno
FROM T1
INNER JOIN T2 ON T1.Empno = T2.Empno
WHERE T1.Ename = 'Seeta';
This query joins the two tables on the Empno field and then filters the results to only include rows where the Ename is 'Seeta'. The Deptno of these rows is then displayed.
(2) To display Empno, Ename, and Deptno, you can use the following SQL query:
SELECT T1.Empno, T1.Ename, T2.Deptno
FROM T1
INNER JOIN T2 ON T1.Empno = T2.Empno;
This query joins the two tables on the Empno field and then displays the Empno and Ename fields from table T1 and the Deptno field from table T2.
Similar Questions
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
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
Write a query to display the ename of employees working in 'HR' department and who draw an annual salary greater than 1000000. [Consider employees who work in multiple departments too]. Display the records sorted in ascending order based on employee ename.Note:1. Display all the ename of employees working in 'HR' department and having annual salary greater than 1000000.2. Use Joins. Tables involved are employee, works and department3. Order by is mandatory.
Write SQL QueriesEmployee TableDepartment Table1. Get the list of employees whose salary is more than 20K and are in HR department.2. Get the salary being paid to each Department.3. Get the employees with the third highest salary.4. Name and designation of the employees who don't have any manager
write sql query for the following:1. create database - emp2.create table - employee with 4 columns3.To see table structure
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.