What are the differences between UNION and JOINS?
Answers were Sorted based on User's Feedback
Answer / saravakumar
A join selects columns from 2 or more tables. A union
selects rows.
| Is This Answer Correct ? | 7 Yes | 0 No |
Answer / sree
UNION:The SQL UNION operator combines two or more SELECT
statements.
JOINS:SQL joins are used to query data from two or more
tables, based on a relationship between certain columns in
these tables.
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / nikhila reddy
UNION:the both tables should have same structure and datatype.
the column name will taken as first table ones it wont bother abt other tables.
example:
emp table as
eid ename esal
1 a 10k
2 b 20k
dept table as
deptid deptname deptsal
11 aa 20k
12 bb 50k
select * from emp
union
select * from dept
empid empname empsal
1 a 10k
2 b 20k
11 aa 20k
12 bb 50k
now u can observe col name taking alias of first table.
no need of relation between a tables.
it will remove duplicate records.
joins:it will join only required fields from different tables.
no need of same structure for tables..
it should have relation between a tables.
| Is This Answer Correct ? | 0 Yes | 0 No |
select names starts with a,b,c
8 Answers Scope International,
Tell me the difference between clustered and non-clustered index?
what is the primary use of the model database? : Sql server administration
What is difference between stored procedure & function?
3 Answers CarrizalSoft Technologies, Concept Infoway, TATA,
How do I make a resultset scrollable?
What is difference beteen Migration and Upgrdation?
I have a table emp , Fields with empname,dnname,dno,salary. now I want copy distinct salary with all emp detail from emp into new table which is not already exist in database. how would I do this ?
How can i Relate Tables in SSIS
Does group by or order by come first?
Explain triggers?
Explain system rowset functions?
Explain how dts is used to extract, transform and consolidate data?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)