Thursday, 23 June 2016

Question and Answers in Sql Server - Part 15

In This post Let we see some important question and answers in Sql Server, which is a continuation of previous post.


57.  What is valid xml and well formed xml?
  
            Well Formed XML: XML which adheres to the syntax rules.
            Valid XML: It is a well formed xml and which is validated against rules present in DTD



58.  Usage of Explicit XML?
            The output of the explicit mode contains all the information of the resulting XML tree. The FOR XML clause in EXPLICIT mode associates with every element, a tag number of the current element and tag number for parent element. This tag numbers are stored in separate columns, named Tag and Parent Respectively.


SELECT      1           AS Tag,
            NULL        AS Parent,
            id          AS [Employees!1!id],
            department AS [Employees!1!dept],
            name        AS[Employees!1]
FROM  employee
FOR XML EXPLICIT


Output:
            <Employees id="2" dept="Tech">DF</Employees>
<Employees id="3" dept="HR">Siv</Employees>
<Employees id="4" dept="BA">SS</Employees>
           


59.  What are the operators present in SQL Server?

o   Arithmetic Operators [+,-,*,/,%]
o   Logical Operators [ALL,AND,OR,ANY,BETWEEN,IN,EXISTS,LIKE]
o   Comparison Operators [=, <,>,>=, <=, <>,! =]
o   Assignment Operators [=]
o   Bitwise Operators [&, |,^]
o   Unary Operator [+,-,~]
o   Compound Operator [+=,*=,-=,/=,&=,^=,|=]



60.  What is the Data Integrity?
            Data Integrity means maintaining accurate, reliable and consistent data during any operation.


·         Entity Integrity
It ensures that each row in a table must be unique identified by an attribute, called primary key
·         Domain Integrity
It ensures that only a valid range of values is allowed to be stored in a column. It restricts the type of data, range of values and format of data.
·         Referential Integrity
It ensures that all the values in the foreign key match the values in primary key.
·         User-Defined Integrity
It enforces the data integrity on tables in two ways by defining constraints or by defining rules.



No comments:

Post a Comment