SQL SERVER – 2008 – Interview Questions and Answers – Part 1

Click here to get free chapters (PDF) in the mailbox

SQL SERVER – 2008 – Interview Questions and Answers Complete List Download

1) General Questions of SQL SERVER

What is RDBMS?

Relational Data Base Management Systems (RDBMS) are database management systems that maintain data records and indices in tables. Relationships may be created and maintained across and among the data and tables. In a relational database, relationships between data items are expressed by means of tables. Interdependencies among these tables are expressed by data values rather than by pointers. This allows a high degree of data independence. An RDBMS has the capability to recombine the data items from different files, providing powerful tools for data usage. (Read More Here)

What are the properties of the Relational tables?

Relational tables have six properties:

  • Values are atomic.
  • Column values are of the same kind.
  • Each row is unique.
  • The sequence of columns is insignificant.
  • The sequence of rows is insignificant.
  • Each column must have a unique name.

What is Normalization?

Database normalization is a data design and organization process applied to data structures based on rules that help building relational databases. In relational database design, the process of organizing data to minimize redundancy is called normalization. Normalization usually involves dividing a database into two or more tables and defining relationships between the tables. The objective is to isolate data so that additions, deletions, and modifications of a field can be made in just one table and then propagated through the rest of the database via the defined relationships.

What are different normalization forms?

1NF: Eliminate Repeating Groups

Make a separate table for each set of related attributes, and give each table a primary key. Each field contains at most one value from its attribute domain.

2NF: Eliminate Redundant Data

Solarwinds

If an attribute depends on only part of a multi-valued key, remove it to a separate table.

3NF: Eliminate Columns Not Dependent On Key

If attributes do not contribute to a description of the key, remove them to a separate table. All attributes must be directly dependent on the primary key. (Read More Here)

BCNF: Boyce-Codd Normal Form

If there are non-trivial dependencies between candidate key attributes, separate them out into distinct tables.

4NF: Isolate Independent Multiple Relationships

No table may contain two or more 1:n or n:m relationships that are not directly related.

5NF: Isolate Semantically Related Multiple Relationships

There may be practical constrains on information that justify separating logically related many-to-many relationships.

ONF: Optimal Normal Form

A model limited to only simple (elemental) facts, as expressed in Object Role Model notation.

DKNF: Domain-Key Normal Form

A model free from all modification anomalies is said to be in DKNF.

Remember, these normalization guidelines are cumulative. For a database to be in 3NF, it must first fulfill all the criteria of a 2NF and 1NF database.

What is De-normalization?

De-normalization is the process of attempting to optimize the performance of a database by adding redundant data. It is sometimes necessary because current DBMSs implement the relational model poorly. A true relational DBMS would allow for a fully normalized database at the logical level, while providing physical storage of data that is tuned for high performance. De-normalization is a technique to move from higher to lower normal forms of database modeling in order to speed up database access.

What is Stored Procedure?

A stored procedure is a named group of SQL statements that have been previously created and stored in the server database. Stored procedures accept input parameters so that a single procedure can be used over the network by several clients using different input data. And when the procedure is modified, all clients automatically get the new version. Stored procedures reduce network traffic and improve performance. Stored procedures can be used to help ensure the integrity of the database.

e.g. sp_helpdb, sp_renamedb, sp_depends etc.

What is Trigger?

A trigger is a SQL procedure that initiates an action when an event (INSERT, DELETE or UPDATE) occurs. Triggers are stored in and managed by the DBMS. Triggers are used to maintain the referential integrity of data by changing the data in a systematic fashion. A trigger cannot be called or executed; DBMS automatically fires the trigger as a result of a data modification to the associated table. Triggers can be viewed as similar to stored procedures in that both consist of procedural logic that is stored at the database level. Stored procedures, however, are not event-drive and are not attached to a specific table as triggers are. Stored procedures are explicitly executed by invoking a CALL to the procedure while triggers are implicitly executed. In addition, triggers can also execute stored procedures.

Nested Trigger: A trigger can also contain INSERT, UPDATE and DELETE logic within itself, so when the trigger is fired because of data modification it can also cause another data modification, thereby firing another trigger. A trigger that contains data modification logic within itself is called a nested trigger. (Read More Here)

What is View?

A simple view can be thought of as a subset of a table. It can be used for retrieving data, as well as updating or deleting rows. Rows updated or deleted in the view are updated or deleted in the table the view was created with. It should also be noted that as data in the original table changes, so does data in the view, as views are the way to look at part of the original table. The results of using a view are not permanently stored in the database. The data accessed through a view is actually constructed using standard T-SQL select command and can come from one to many different base tables or even other views.

What is Index?

An index is a physical structure containing pointers to the data. Indices are created in an existing table to locate rows more quickly and efficiently. It is possible to create an index on one or more columns of a table, and each index is given a name. The users cannot see the indexes; they are just used to speed up queries. Effective indexes are one of the best ways to improve performance in a database application. A table scan happens when there is no index available to help a query. In a table scan SQL Server examines every row in the table to satisfy the query results. Table scans are sometimes unavoidable, but on large tables, scans have a terrific impact on performance.

What is a Linked Server?

Linked Servers is a concept in SQL Server by which we can add other SQL Server to a Group and query both the SQL Server dbs using T-SQL Statements. With a linked server, you can create very clean, easy to follow, SQL statements that allow remote data to be retrieved, joined and combined with local data. Stored Procedure sp_addlinkedserver, sp_addlinkedsrvlogin will be used add new Linked Server. (Read More Here)

© Copyright 2000-2009 Pinal Dave. All Rights Reserved. SQLAuthority.com

Reference : Pinal Dave (https://blog.sqlauthority.com)

Solarwinds
, , , , ,
Previous Post
SQLAuthority News – 700 Articles and Author Updates
Next Post
SQL SERVER – Interview Questions and Answers – Part 2

Related Posts

237 Comments. Leave new

  • ihave problame whene i restor data base give me msg no 3205 i try serval times

    Reply
  • Thank you sir..

    Reply
  • Shahid Ansari
    April 18, 2011 5:36 pm

    Hello Sir,

    i am really surprise when i got ur this site.

    pls send more SQL interview questions and answers

    Thanks & Regards

    Shahid Ansari

    Reply
  • hi,
    Thanks for the availability of the all interviwe quetion sir
    i am just biggener i want to read more and more in sql server
    commands and all relation ship

    thaks once agine

    Reply
  • Hozefa Unwala
    June 11, 2011 3:38 am

    I am writing one stored procedure which has parameter as well. I also need to some kind of programming logic as well. Here is my copy of stored procedure.
    I got an error that conversion failed while converting varchar to int datatype….I am using parameters and query in single quotation becasue of I am running some programming logic as well.

    What would be the error?
    Thanks.

    Reply
  • I have a procedure which is performing merge(update/insert) , i would like to know how to add Exception handling where i can insert that error message in the table

    I’ve checked with Try..Catch , but am finding some problem … Can any one give an example for Exception handling in procedure

    Reply
  • Hi, what is the best way to store ip address in SQL.. int, char? Why?

    Reply
    • If it is fixed length, use char datatype. Otherwise you need to split and do some calculation to determine it if you use int datatype

      Reply
  • Thanks for the very good FAQ’s on SQL Server.

    Reply
  • Can any one tell me what is the pros and cons of using SQL Cache dependency in .net

    Reply
  • Thanks Pinal for providing the so detailed information about the SQL.

    I am feraz ahmad , I have 6 years of experience in web development but I am enjoying more in the data base front. I want to pursue my career in the SQL DBA.
    Please suggest me correct path and where I can focus and achieve my goal.
    Thanks in advance.

    Reply
  • Hi,
    I want database testing interview questions and answers. So please help me

    Reply
  • What is a Word Wheel in sql??

    Reply
  • hi iam geeta right now v r in training period on sql server2008 may i know how was the reqiuirements for this domain

    Reply
    • Hi Geetha, Ram here, as u said that u r in training period on SQL SERVER 2008,bt best of my knowledge,no such institutes provides full in depth of training on domain,but the things they teach us will be usefull,n it will be fully depends upon u how u involve to learn the concepts, and requirements for this domain as a fresher it would be bit tougher but for 2+ experience it wrks out…..in hyderabad as well as in BANGlore n Chennai n pune..

      Reply
  • Hi Pinal..

    thanks in advance

    Could u say me how Many type of Triggers in Sql 2008 Like DDL trigger, Instead of Trigger, Before and After, like Wise

    regards
    logu

    Reply
  • hiiiiiiiiiiiiiii guyzzzzzzzzzzzzzzzzzzzzz?
    i have one doubt in sql that is
    in synonyms invalid cases r there.then i want to knw the wat is invalid case ?nd how many cases r there?at what situations r considered as invalid?

    Reply
  • gyanesh sharma

    Q…..how to create table in sql server without using create table table_name query? is there any alternative ??????

    Reply
  • @Gyanesh,

    You can use the designer to do this if u do not want to write the script.Just right click on the Tables in the object explorer under the required database and select New Table option and set the appropriate properties.

    Else,
    if u want to create table with the same schema as one of the existing tables , then u can use SELECT clause for this.
    Ex : SELECT Col1,Col2 INTO New_Table_Name FROM Existing_Table_Name

    Reply
  • wah..

    Reply
  • plz send me details of sql interview questions n answers

    Reply
  • hi
    i have a table name employee ..where the columns are- emp_name,emp_dept,emp_desig,salary..
    now i want to see the department wise total salary and name of those employees whose sum of salary greater than 10000

    Reply

Leave a Reply

Menu