You are on page 1of 2

1.Difference between Correlated subquery and Nested subquery S.

No 1 Correlated subquery Correlated subquery runs once for each row selected by the outer query. It contains a reference to a value from the row selected by the outer query. Correlated subquery follows down to top approach i.e., main query is executed first(even though parenthesis are present) and then child query. We can also say: in a Correlated subquery,Inner query condition is used in the outer query 4 Example: select e1.empname, e1.basicsal, e1.deptno from emp e1 where e1.basicsal = (select max(basicsal) from emp e2 where e2.deptno = e1.deptno) Nested subquery Nested subquery runs only once for the entire nesting (outer) query. It does not contain any reference to the outer query row. Nested subquery follows top-down approach i.e., child query is executed first and then parent . We can also say:In a subquery Outer query condition is used in the the inner query.

Example: select empname, basicsal, deptno from emp where (deptno, basicsal) in (select deptno, max(basicsal) from emp group by deptno)

2.Difference between Weak Entity Set and Strong Entity Set

S.No 1

Weak Entity Set An entity set which does not possess sufficient attributes to form a primary key is known as a weak entity set. Member of a weak entity set is a subordinate entity. Example: Specific Person,Company,Event,Plant

Strong Entity Set An entity set which does have a primary key is called a strong entity set. Member of a strong entity set is a dominant entity. Example: Set of all Persons,Companies,Trees,Holidays

2 3

3.Difference between char and varchar data types in Sql Server S.No 1 2 Char Fixed length memory storage CHAR takes up 1 byte per character Use Char when the data entries in a column are expected to be the same size like phone number Ex: Declare test Char(100); test="Test" Then "test" occupies 100 bytes first four bytes with values and rest with blank data Varchar Variable length memory storage(Changeable) VARCHAR takes up 1 byte per character, + 2 bytes to hold length information Use Varchar when the data entries in a column are expected to vary considerably in size like address Ex: Declare test VarChar(100); test="Test" Then "test" occupies only 4+2=6 bytes. first four bytes for value and other two bytes for variable length information.

4.Difference between Sql Server 2005 and Sql Server 2008 S.No 1 2 3 4 5 6 7 Sql Server 2005 XML datatype is introduced. Cannot encrypt the entire database. Datetime is used for both date and time. No table datatype is included. SSIS is started using. CMS is not available. PBM is not available Sql Server 2008 XML datatype is used. Can encrypt the entire database introduced in 2008. Date and time are seperately used for date and time Table datatype introduced. SSIS avails in this version. Central Management Server(CMS) is Introduced. Policy based management(PBM) server is Introduced.

You might also like