IGNOU BCA MCA Students - VIVA Question Answer for SQL Server
SQL Server with .Net Selected Question Answer - PART II
Ques9) What
are different Types of Join?
Ans ) 1) Cross Join A
cross join that does not have a WHERE clause produces the Cartesian product of
the tables involved in the join. The size of a Cartesian product result set is
the number of rows in the first table multiplied by the number of rows in the
second table. The common example is when company wants to combine each product
with a pricing table to analyze each product at each price.
2)Inner Join A join
that displays only the rows that have a match in both joined tables is known as
inner Join. This is the default type of join in the Query and View Designer.
3)Outer Join A join
that includes rows even if they do not have related rows in the joined table is
an Outer Join. You can create three different outer join to specify the
unmatched rows to be included:
- Left Outer
Join:
In Left Outer Join all rows in the first-named table i.e.
"left" table, which appears leftmost in the JOIN clause are
included. Unmatched rows in the right table do not appear.
- Right Outer
Join:
In Right Outer Join all rows in the second-named table i.e.
"right" table, which appears rightmost in the JOIN clause are
included. Unmatched rows in the left table are not included.
- Full Outer Join: In Full Outer Join all rows in all joined tables are included, whether they are matched or not.
- Self Join This is a particular case when one table joins to itself, with one or two aliases to avoid confusion. A self join can be of any type, as long as the joined tables are the same. A self join is rather unique in that it involves a relationship with only one table. The common example is when company has a hierarchal reporting structure whereby one member of staff reports to another. Self Join can be Outer Join or Inner Join.
Ques 10)Differentiate between a Local and a Global temporary
table?
Ans)- A local temporary table exists only for
the duration of a connection or, if defined inside a compound statement, for
the duration of the compound statement.
- Global temporary tables (created with a double “##”) are visible to all sessions.
- Global temporary tables are dropped when the session that created it ends, and all other sessions have stopped referencing it.
- Global temporary tables (created with a double “##”) are visible to all sessions.
- Global temporary tables are dropped when the session that created it ends, and all other sessions have stopped referencing it.
Ques 11)Explain different types of Locks in SQL Server.
Ans)- There are 3 kinds of locks in SQL Server
i.) Shared locks - they are used for operations which do not allow any change or update of data. For e.g. SELECT.
ii.) Update locks - they are used when SQL Server wants to modify a page. The update page lock is then promoted to an exclusive page lock before actually making the changes.
iii.) Exclusive locks - they are used for the data modification operations. For e.g. UPDATE, INSERT, or DELETE.
i.) Shared locks - they are used for operations which do not allow any change or update of data. For e.g. SELECT.
ii.) Update locks - they are used when SQL Server wants to modify a page. The update page lock is then promoted to an exclusive page lock before actually making the changes.
iii.) Exclusive locks - they are used for the data modification operations. For e.g. UPDATE, INSERT, or DELETE.