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

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)

Database, SQL Constraint and Keys, SQL Index, SQL Scripts, SQL Stored Procedure, SQL Trigger
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

  • Thanks for This /sql-server-2008-interview-questions-and-answers-part-All/

    Reply
    • hi,..
      i have just completed my B.C.A
      and i have done sql server 2005 in dba from niit.
      so i m looking job in data base plz suggest me few option.

      thanks.

      Reply
  • ihad completed my MCA.I learn the sqlserver and c#.net course.now i am searching job in software engenering. I want to know the data base like sql server.

    I want to know the all faq’s of SQL server and queries.pls send me the list of questions to my ID.

    Reply
  • pls send more interview questions and answers in sql

    Reply
  • send more questions and answers in sql

    Reply
  • hi i m working in telecom company as s.e. and i m working in sql server 2008 database ,i want know about sql developer,
    please send me sql developer interview questions and answers.

    Reply
  • Hi Pinal,

    I am asked this question frequently in my interviews.

    What kind of updates are found from sqlserver2005 to 2008?

    I tried different sites could not find all of them

    Thanks,
    Sravanthi

    Reply
  • Hi ..could u pls suggest me any gud website for interview questions of SQL DBA and developer

    Reply
  • nice answers

    Reply
  • Hi pinal
    i would like to thank u for such a good effort that u done. then kindly tel me about the concept of joins

    Reply
  • This is one of the best article.
    Through anyone easily understand about the SQL server basics.

    Thanks……

    Reply
  • Sir, i have completed my BCA and i have decided to join the Dot net course. How is dot net course related to Sql server 2008 or DBA. what are the chances of getting the job if i simultaneously complete both the courses. Please help me regarding this matter. I am really confused

    Reply
    • hi ,
      this is vijay bhatt from Udaipur ,
      need not to confuse it is jest a backend , u can also use
      Oracle , DB2 , Infomix etc.
      but now mostly compeny use Sql Server so u can learn easily
      , try to concentrate .net application .. Go on project ..
      Good Luck
      vijay bhatt

      Reply
  • Hi sir,
    I am emmanuel.
    what is the syntax for Left outer join and right outer join?

    Reply
  • Hi,

    Can you tell me how to copy the table contents from one server to another server.

    Eg:

    Server : server 1
    Database: db1
    Table : tb1

    Server : server2
    Database: db2
    Table : tb2

    i want to copy the tb1 data into tb2. Please help me?

    Reply
    • take bakup of ur database table on one server .
      and again restore another database .. its simple ..
      try it .

      Reply
  • Hi can any one give me an example for creating a complex views using oder by statemnt

    Reply
  • Hi ,
    I have one question that ,
    why Stored Procedure execute fast ?
    can any one give me answer …
    Vijay bhatt

    Reply
  • hi ,
    how can i convert or atteach database
    sql server 2000 to 2005 .
    with contain …
    is it possible…

    vijay bhatt

    Reply
  • Sir

    i Prasanna dadhich haveing 2.6 year exp as DBA

    now a days i am looking another job

    but some are the question when the interviewee ask me i was confused please help

    1) how to reduse .ndf file size and where it is located

    2) why the ldf file size bigger than .mdf file

    3) what are the technical diff bet 2000 and 2005

    4) if master db is deleted what will happen and to recover it

    5) what are the disadvantage of sql 2005

    please reply

    waiting for that

    [email removed.]

    Reply
  • Hi Pinal,
    I have 2 server, one is installed sql 2008 another one is sql 2000,
    I have connected both with linked server, I can able to access from 2008 server to
    sql 2000 table but from sql 2000 server to sql 2008 is not
    working ..
    Iam getting error “General network error. Check your network documentation.”.
    can you help me to access from sql2000 to sql2008 db through linkedserver?

    Thanks in advance

    SankarA

    Reply
  • rajinder kaur
    March 23, 2011 2:58 pm

    hello sir
    when i open sql then it not oprate the recruitment and pubs pis sugesed me what i do

    Reply
  • Kapil Dev Tripathi
    March 26, 2011 3:22 pm

    Hi Pinal,
    I am regular reader of your blog. I have a problem.

    I have a table name T1 having only one Column name Col1 having rows –

    Col1

    a

    b

    c

    And another table name T2 also having only one Column name Col1 having rows –

    Col1

    x

    y

    z

    Now I want record in following format-

    Col1 Col2
    a x

    b y

    c z
    This is my first question , I need it in very urgent basis. Please help sir…

    Reply
    • Hello Kapil Dev Tripathi,

      You can add same types of primary keys (viz. PK) in both the tables (Just auto incremental value) and run some kind of query like:

      Select Table1.Col1, Table2.Col2
      FROM Table1 INNER JOIN Table2 ON Table1.PK = Table2.PK

      Regards.

      To Pinal : Keep up your great work !

      Reply

Leave a Reply