1.Difference between Correlated subquery and Nested subquery

      S.No   Correlated subquery                   Nested subquery

      1      Correlated subquery runs once for     Nested subquery runs only once for the
             each row selected by the outer        entire nesting (outer) query. It does not
             query. It contains a reference to a   contain any reference to the outer
             value from the row selected by the    query row.
             outer query.

      2      Correlated subquery follows down      Nested subquery follows top-down
             to top approach i.e., main query      approach i.e., child query is executed
             is executed first(even though         first and then parent .
             parenthesis are present) and then
             child query.                          We can also say:In a subquery
                                                   Outer query condition is used in the
             We can also say: in a Correlated      the inner query.
             subquery,Inner query condition is
             used in the outer query

      4      Example:                              Example:

             select e1.empname, e1.basicsal,       select empname, basicsal, deptno from
             e1.deptno from emp e1                 emp

             where e1.basicsal = (select           where (deptno, basicsal) in (select
             max(basicsal) from emp e2 where       deptno, max(basicsal) from emp group
             e2.deptno = e1.deptno)                by deptno)


2.Difference between Weak Entity Set and Strong Entity Set


      S.No   Weak Entity Set                       Strong Entity Set

      1      An entity set which does not          An entity set which does have a
             possess sufficient attributes to      primary key is called a strong entity
             form a primary key is known as a      set.
             weak entity set.

      2      Member of a weak entity set is a      Member of a strong entity set is a
             subordinate entity.                   dominant entity.

      3      Example:                              Example:

             Specific                              Set of all
             Person,Company,Event,Plant            Persons,Companies,Trees,Holidays
3.Difference between char and varchar data types in Sql Server

      S.No   Char                                 Varchar

      1      Fixed length memory storage          Variable length memory
                                                  storage(Changeable)

      2      CHAR takes up 1 byte per             VARCHAR takes up 1 byte per
             character                            character, + 2 bytes to hold length
                                                  information

      3      Use Char when the data entries in    Use Varchar when the data entries in a
             a column are expected to be the      column are expected to vary
             same size like phone number          considerably in size like address

      4      Ex:                                  Ex:
             Declare test Char(100);              Declare test VarChar(100);
             test="Test" -                        test="Test" -
             Then "test" occupies 100 bytes       Then "test" occupies only 4+2=6
             first four bytes with values and     bytes. first four bytes for value and
             rest with blank data                 other two bytes for variable length
                                                  information.



4.Difference between Sql Server 2005 and Sql Server 2008

      S.No   Sql Server 2005                      Sql Server 2008

      1      XML datatype is introduced.          XML datatype is used.

      2      Cannot encrypt the entire            Can encrypt the entire database
             database.                            introduced in 2008.

      3      Datetime is used for both date and   Date and time are seperately used for
             time.                                date and time

      4      No table datatype is included.       Table datatype introduced.

      5      SSIS is started using.               SSIS avails in this version.

      6      CMS is not available.                Central Management Server(CMS) is
                                                  Introduced.

      7      PBM is not available                 Policy based management(PBM)
                                                  server is Introduced.

Sql server difference faqs- 4

  • 1.
    1.Difference between Correlatedsubquery and Nested subquery S.No Correlated subquery Nested subquery 1 Correlated subquery runs once for Nested subquery runs only once for the each row selected by the outer entire nesting (outer) query. It does not query. It contains a reference to a contain any reference to the outer value from the row selected by the query row. outer query. 2 Correlated subquery follows down Nested subquery follows top-down to top approach i.e., main query approach i.e., child query is executed is executed first(even though first and then parent . parenthesis are present) and then child query. We can also say:In a subquery Outer query condition is used in the We can also say: in a Correlated the inner query. subquery,Inner query condition is used in the outer query 4 Example: Example: select e1.empname, e1.basicsal, select empname, basicsal, deptno from e1.deptno from emp e1 emp where e1.basicsal = (select where (deptno, basicsal) in (select max(basicsal) from emp e2 where deptno, max(basicsal) from emp group e2.deptno = e1.deptno) by deptno) 2.Difference between Weak Entity Set and Strong Entity Set S.No Weak Entity Set Strong Entity Set 1 An entity set which does not An entity set which does have a possess sufficient attributes to primary key is called a strong entity form a primary key is known as a set. weak entity set. 2 Member of a weak entity set is a Member of a strong entity set is a subordinate entity. dominant entity. 3 Example: Example: Specific Set of all Person,Company,Event,Plant Persons,Companies,Trees,Holidays
  • 2.
    3.Difference between charand varchar data types in Sql Server S.No Char Varchar 1 Fixed length memory storage Variable length memory storage(Changeable) 2 CHAR takes up 1 byte per VARCHAR takes up 1 byte per character character, + 2 bytes to hold length information 3 Use Char when the data entries in Use Varchar when the data entries in a a column are expected to be the column are expected to vary same size like phone number considerably in size like address 4 Ex: Ex: Declare test Char(100); Declare test VarChar(100); test="Test" - test="Test" - Then "test" occupies 100 bytes Then "test" occupies only 4+2=6 first four bytes with values and bytes. first four bytes for value and rest with blank data other two bytes for variable length information. 4.Difference between Sql Server 2005 and Sql Server 2008 S.No Sql Server 2005 Sql Server 2008 1 XML datatype is introduced. XML datatype is used. 2 Cannot encrypt the entire Can encrypt the entire database database. introduced in 2008. 3 Datetime is used for both date and Date and time are seperately used for time. date and time 4 No table datatype is included. Table datatype introduced. 5 SSIS is started using. SSIS avails in this version. 6 CMS is not available. Central Management Server(CMS) is Introduced. 7 PBM is not available Policy based management(PBM) server is Introduced.