Tuesday, August 11, 2009

FAQ : What is String summary statistics in SQL Server?

SQL Server 2005 introduces additional information collected by statistics created on char, varchar, varchar(max), nchar, nvarchar, nvarchar(max), text, and ntext columns. This information, called a string summary, helps the query optimizer estimate the selectivity of query predicates on string patterns . This helps the optimizer better estimate the selectivity of conditions that use the LIKE operator. String summary information is not maintained if the summary for a column sample is larger than the Database Engine can maintain. For example, a string summary will not be maintained on statistics created by using WITH FULLSCAN on a unique varchar(80) column with 80 characters in each string, almost no similarity between strings, on a table with 85,000 rows. To determine whether a string summary is stored for a particular statistics object, use DBCC SHOW_STATISTICS (Transact-SQL) .

Monday, August 3, 2009

FAQ : What is Equi-JOIN and Non-Equi JOIN in SQL

What is Equi-Join?

When a JOIN is made on Exact match between two columns it is called equi-Join.
Eg.
SELECT A.*
FROM EMPLOYEES A, EMPLOYEE_SAL B
WHERE A.EMP_ID=B.EMP_ID
OR
SELECT A.*
FROM EMPLOYEES A
INNER JOIN EMPLOYEE_SAL B
ON A.EMP_ID=B.EMP_ID
Both the queries mentioned above can be considered as Equi-join.

What is NON-Equi Join.

If you use any other comparison operator other than = in JOIN condition, it is called NON-Equi JOIN
SELECT A.*
FROM EMPLOYEES A, EMPLOYEE_SAL B
WHERE A.EMP_ID <> B.EMP_ID
 
Locations of visitors to this page