Difference between join and a subquery?
Answers were Sorted based on User's Feedback
Answer / kiran
subquery can be used for simple logical queries , to get
required output/condition
but if you want to compare two or more tables and get output
in the way you want it would be lot difficult to manage all
those with subqueries - so we can use the concept of joins
| Is This Answer Correct ? | 39 Yes | 5 No |
Answer / maddy
Subquery is also query which returns one or more values we
can retriew the data based on the where contd="IN,ALL"...
subquery is the query followed by the main query....
join is used to join the two table is used to retriew the
data from 1 or more tables.....
| Is This Answer Correct ? | 27 Yes | 12 No |
Answer / neo devan
A query inside a query or next level query is called
subquery, a subquery can return 1 or more values to the
main query.
Ex: select * from emptable where deptno=(select deptno from
saltable where rownum=1);
A Join is used to query two tables, or views.
Ex: select * from emptable inner join saltable on
emptable.deptno=saltable.deptno;
| Is This Answer Correct ? | 18 Yes | 7 No |
Answer / bhuvana
Joins-
1.Want to combine and fetch data from more than 2 tables.
2.Joins are faster, efficient, easy to understand and better performance.
Subquery-
Want to combine and fetch data from a pair of table.
| Is This Answer Correct ? | 10 Yes | 3 No |
Answer / katty
When data is to be retrieved from one table based on the condition from another table subquery is used
When the data is to be retrieved from both the tables join is used
| Is This Answer Correct ? | 10 Yes | 5 No |
Answer / ashi
Sub query: The sub query has more than one select
statement,the inner query which executes first and then it
will be the value of the 2nd query.
EX:
select ename from emp where sal>(select avg(sal) from emp);
Joins:
When the data from more than one table in the database,then
a join condition used.Rows in the one table can be joined to
rows in the other table according ro the common values
existing in corresponding columns
EX:
select dname,ename from emp,dept where emp.deptid=dept.deptid;
| Is This Answer Correct ? | 9 Yes | 5 No |
Answer / rajasekhar
sub query: it is a query to get the answer for multiple questions
joins: it is used for getting the data from more then two tables
| Is This Answer Correct ? | 4 Yes | 2 No |
what is the syntax of SELECT command?
What is the quickest way to export a table to a flat file?
What is oracle open database communication (odbc)?
What privilege is needed for a user to create views in oracle?
State all possible different index configurations a table can possibly have?
What are the differences between primary key and unique key?
How to handle a single quote in oracle sql?
what are different types of deletes?
what is RAID technology?which is better RAID 0+1 OR RAID 5?
What is difference between sid and service name in oracle?
Display the order number and the number of months since the order was shipped for all orders that have been shipped in the last year (365 days). (Hint: Unshipped orders will have a null value).
Is oracle a language?