Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is the difference between in and exists.
Ex: select * from emp where empno in(....) and
select * from emp where empno exists(....)

What is the difference between a Join and Union and Union
and UnionAll.

Answer Posted / nandkumar karlekar

Answer:-

1. Union is heavy as compare to Union All

2. result of Union Query is Set where as result of
Union ALL is not a Set it’s only concatenation of two
results

3. Suppose table1 and table2 have T1 ,T2 records
respectively then the number of comparison require to
produce result is as follows



Union All requires O (1) time complexity

Union Requires O ((T1*(T1+1)/2) + (T2*(T2+1)/2) + (T1 *T2))





Example for UNION: - Table1 has 10 records

Table2 has 20 records

Suppose: table1 and table2 has all record distinct.



Total comparisons require = 465 comparisons



Example for UNION ALL: -

Table1 has 10 records

Table2 has 20 records



Suppose: table1 and table2 has all record distinct or not,
no problem.



Total comparisons require = Constant or may be 0

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

explain different types of backups avaialabe in sql server? Given a particular scenario, how would you go about choosing a backup plan? : Sql server database administration

1014


What is the difference between the application object and session object?

1014


what is the difference between Delete and Truncate command in SQL

1086


what is a schema in sql server 2005? : Sql server database administration

959


How to create hyperlink from returned sql query ?

1074


What is sparse columns of sql server 2008?

995


What samples and sample databases are provided by microsoft?

978


Explain the categories of stored procedure?

889


What is a derived table?

871


Explain an incremental backup?

939


How to edit table in sql server 2017?

881


What is a db view?

856


Can you pass expressions to stored procedure parameters?

972


How we create SQL Server 2005 Reporting Services ? Give me Sample

1940


Give the query of getting last two records from the table in SQL SERVER?

901