0% found this document useful (0 votes)
126 views

SQL Server

The document discusses various concepts related to SQL Server including: 1) The three normal forms in SQL are first, second, and third normal form which define rules for how tables can be structured to reduce data redundancy. 2) Characteristics of a well-designed normalized database include tables for single entities, unique identifiers, avoidance of duplicate or nullable values. 3) Normalization is the process of structuring tables according to normal forms to avoid issues like update anomalies. There are three common types of normalization. 4) SQL Server supports various data types like DATE, TIME, DATETIME2 for storing temporal data.

Uploaded by

ashokreddy44
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
126 views

SQL Server

The document discusses various concepts related to SQL Server including: 1) The three normal forms in SQL are first, second, and third normal form which define rules for how tables can be structured to reduce data redundancy. 2) Characteristics of a well-designed normalized database include tables for single entities, unique identifiers, avoidance of duplicate or nullable values. 3) Normalization is the process of structuring tables according to normal forms to avoid issues like update anomalies. There are three common types of normalization. 4) SQL Server supports various data types like DATE, TIME, DATETIME2 for storing temporal data.

Uploaded by

ashokreddy44
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

SQL SERVER

1. What is third normal form in SQL ?

To be in third normal form i.e 3NF , non key field should not depend on other non key
field. In other words, third normal form does not permit any strictly informational
attribute to depend upon anything other than a superkey.

2. What is second normal form in SQL ?

To be in second normal form i.e 2NF , all information attributes or fields of the table are
attributes of entity of table schema. All information fileds in the table is directly related to
entire primary key or entity of table.

3. What is first normal form in SQL ?

To be in first normal formal i.e 1NF , each fields in table should be atomic and unique.
There should not be any duplicate information.

4. What are characterstics of well designed normalized database ?

Characteristics of well designed normalized database are :

1. Table should have identifier


2. Table should store data for single type of entity
3. Table should not have repeating values or columns
4. Table should avoid nullable columns

5. What is noramaization and different types of normalization ?

Normalization is set of rules to design tables and table relationships. Normalized database
would have large number of narrow tables i.e with less number of columns.

There are 3 types of normalization :

1. First Normal Form


2. Second Normal Form
3. Third Normal Form

6. What is computed column ?

Computed Column is virtual column in table whose value is computed at runtime.The


values are not stored in table but computed by the expression that defines column.
7. State different types of indexes

There are two types of indexes :

1. Clustered Index
2. Non Clustered Index

8. What does ACID stands for in SQL ?

ACID stands for Atomicity , Consistency , Isolation and Durabilty .

9. What global variable is used to return number of rows returned by


last Transact-SQL ?

@@ROWCOUNT is global variable used to return number of rows returned by last


Transact-SQL.
Question : Two TSQL statements are executed in below order :
DELETE FROM Employee where EmpID=10
UPDATE Employee set EmpSal = 10000 where EmpID = 15
SELECT @@ERROR

A. @@ERROR will store Error Number of Delete statement


B. @@ERROR will store Error Number of Update statement

Answer : B is correct option

Hint : @@ERROR contains error number of last TSQL statement executed.

10. @@ERROR has value of 0. What does it mean ?

@@ERROR with value of 0 indicates no error. @@ERROR with non zero


value indicates error.

11. What global variable is used to return error number of last


Transact-SQL ?

@@ERROR is a global variable used to return error number of last T-SQL.

12. State some new data types in SQL Server 2008 ?

New Data types in SQL Server 2008 are :

1. DATE - occupies 3 bytes . Has accuracy of 1 day . Data stored in 'YYYY-MM-


DD' format
2. TIME - occupies 3 to 5 bytes . Has accuracy of 100 nanoseconds. Data stored in
'hh:mm:ss.nnnnnnn' format.
3. DATETIME2 - occupies 6 to 8 bytes . Has accuracy of 100 nanoseconds. Data
stored in 'YYYY-MM-DD hh:mm:ss.nnnnnnn' format.
4. DATETIMEOFFSET - occupies 8 to 10 bytes . Has accuracy of 100 nanoseconds.
Data stored in 'YYYY-MM-DD hh:mm:ss.nnnnnnn [+|-]hh:mm' format. The
DATETIMEOFFSET data type is similar to DATETIME2 but has time zone
component extra.

13. What is ANSI_PADDING ?

ANSI_PADDING can be set ON or OFF. It controls the way column stores values
shorter than the defined size of the column, and the way the column stores values that
have trailing blanks in char, varchar, binary, and varbinary data.

Transact SQL Statement to set it ON


SET ANSI_PADDING ON

Transact SQL Statement to set it OFF

SET ANSI_PADDING OFF

ANSI_PADDING setting is ON :
char(n) and binary(n) - Pads value with trailing blanks for char columns and with trailing
zeros for binary columns to the length of column.
varchar(n) or varbinary(n) - Trailing blanks in varchar are not trimmed . Trailing zeroes
in varbinary are not trimmed. Does not pads trailing blanks or zeroes to the length of
column.

ANSI_PADDING setting is OFF :

char(n) and binary(n) - Pads value with trailing blanks for char columns and with trailing
zeros for binary columns to the length of column.

varchar(n) or varbinary(n) - Trailing blanks in varchar are trimmed . Trailing zeroes in


varbinary are trimmed. Does not pads trailing blanks or zeroes to the length of column.
14. What is extent in SQL Server ?

Extents are basic unit in which space is allocated to tables and indexes. Extent is eight
contiguous pages i.e 64 KB.

15. What is fundamental unit of storage in SQL Server ?

Page

16. What are different types of DML ( Data Manipulation Language )


statements

Types of DML statements :

1. Select
2. Insert
3. Update
4. Delete

17. What are different types of DCL statements

Types of DCL statements :

1. Grant
2. Revoke
3. Deny

18. What are different types of DDL statements ?

Types of DDL statements :

1. Create
2. Alter
3. Drop

19. What are different types of of TSQL statements ?

Three types of of TSQL statements :

1. Data Definition Language ( DDL )


2. Data Control Language ( DCL )
3. Data Manipulation Language ( DML )

You might also like