suppose I have two table one Emp and other is dpt.
Emp table has a field ,dept id,name ,sal and dpt table has a
field dept id,dept name.
Now I want to find out the emplyee list whose sal is between
2000-3000 from dept x.
Answers were Sorted based on User's Feedback
Answer / mai
Select Name
From Emp e inner join Dpt d
on d.dptid=e.dptid
Where sal>=2000 And sal<=3000
And dptname='x'
Is This Answer Correct ? | 18 Yes | 5 No |
Answer / selvaraj v , anna university
SELECT * FROM EMP E,DEPTS D WHERE E.DEPT_ID=D.DEPT_ID AND
E.SALARY BETWEEN 2000 AND 3000 ORDER BY EMP_NO;
Is This Answer Correct ? | 14 Yes | 4 No |
Answer / manasa
SELECT e.name,d.dept from employee e INNERJOIN dept d ON e.deptid=d.deptid WHERE e.salary between 2000 AND 3000
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / om patel
SELECT E.ENAME FROM EMP E ,DEPT D WHERE E.DEPTNO=D.DEPTNO
AND SAL BETWEEN 2000 AND 3000 AND D.DNAME='X';
Is This Answer Correct ? | 2 Yes | 2 No |
Answer / sravan
You can also solve it by using sub-query
SELECT DISTINCT NAME FROM EMP E
WHERE SAL>2000 AND SAL<3000
AND E.DEPTID IN (SELECT D.DEPTID FROM DPT D
WHERE DEPTNAME='X');
thanks
Is This Answer Correct ? | 0 Yes | 0 No |
select e.department_id,e.last_name,e.salary,d.department_name from employees e,
departments d
where e.department_id=d.department_id and
e.salary between 2000 and 10000
and lower(d.department_name)='finance'
/
Out put
DEPARTMENT_ID LAST_NAME SALARY DEPARTMENT_NAME
------------- ------------------------- ---------- --------------------
100 Faviet 9000 Finance
100 Chen 8200 Finance
100 Sciarra 7700 Finance
100 Urman 7800 Finance
Is This Answer Correct ? | 0 Yes | 0 No |
What are the different datatypes available in PL/SQL?
Which sorts rows in sql?
What happens if a procedure that updates a column of table X is called in a database trigger of the same table ?
what is bdb (berkeleydb)? : Sql dba
what are all the different types of indexes? : Sql dba
What is normalisation and its types?
What makes a good primary key?
What is cte?
How many database objects (trigger, packages, sequence etc) uses a particular field in a given table. For ex: I want to know how many database object uses the ATTRIBUTE1 in the PO_VENDORS table. What query will give me the result showing the database object name(package, trigger etc), field_name used (in this case ATTRIBUTE1) and table_name (in this case PO_VENDORS).
what is the difference between implicit and explicit trigger
take one table is t1 and in that column name is f1 f1 column values are 200 5000 3000 7000 300 600 100 400 800 400 i want display the values asc and desc in a single output. sample output is f1.a 100 200 300 400 500 600 etc...... and f1.d is 5000 4000 3000 2000 1000 etc...
What are the constraints available in sql?