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

  • Nice artical

    Reply
  • i am very much interested to learn sql server can u send complex queries, questions

    Reply
  • Hi Dave

    This is satees kumar reddy. I am learing SQL Server 2005 from last 3 months, it is very interesting. Recently I found your website, it is very excellent to learn sql server. I am intersting to move as a DBA. Please tell me what i am going to do for that.

    Reply
    • Hi sateesh reddy i am also searching data base job. please if u know any information about sql dba jobs please send me mail.

      Reply
    • hi this is bhaskar reddy

      i am in trils now and very confused

      plz help me with clarifications

      Reply
  • can u give more interview questions on sql dba 2005 as i am going to appear for interviews

    Reply
  • plz give me some tips for preparation

    Reply
  • Hi Dave,
    It’s quite a nice article!

    I want to argue about the index, you said here “An index is a physical structure containing pointers to the data”, but I think it is not exactly the case, for non-clustered index it is true, what if for clustered index? The clustered index should contain all data itself but not just a pointer, right?

    Reply
  • Hi All,

    I am priyanka. I prepaired for sql server developer cource.
    Now i want to attend interviews . So please help me for this . I need interview questions and answers from every toipic .
    And also i am preparing for certification exam so anyone knows any links please send me.

    thanks,
    priyanka.

    Reply
  • Neeraj Kathuria
    November 18, 2008 7:40 pm

    Hi Sir/Madam

    I have one year of experience in SQL Server DBA.I want to give interviews.Can you send me updated interview questions on SQL Server on all version of SQL server.

    Regards
    Neeraj

    Reply
  • hi, im learning sql server 205 course.i want sample resume as a sql server developer.can any one please send me resume
    thank
    janaki

    Reply
  • Relational tables have six properties:

    Values are atomic is one of them ,

    but i m not properly clear about atomic , what actually u mean by it here?

    Reply
  • Thank You

    Reply
  • Hi dev,

    ” I wish you very happy married life”

    site is really grate, i am feeling very lucky to have found such a nice site to learn sql server.

    I appreciate you for doing such a wonderful job.

    best regards,
    subbareddy

    Reply
  • priyanka sridhar
    December 18, 2008 1:39 am

    Hi,
    thank u so much.iam very happy to know that even such sites exists!!from here on i’ll visit ur page every day as a ritual.

    may god bless you..keep up the gud work..
    all the bst

    Reply
  • I had a MS SQL Database backed up .bak file which is of 22 GB and i have split it into 22 files of 1 GB each file with a splitter program.
    Is there a method to Restore each of these individually or say I only want to restore the first three files of 1 GB each into another MS sql server database.
    How can i do it ?

    Reply
    • Dear Rakesh,

      You cannot restore the Splited File . you have unsplit it and then restore it……….

      Reply
  • can u give more logical interview questions on sql dba 2005 as i am going to appear for interviews

    Reply
  • Hi pinal,

    i would like to know what is Data integrity?
    What is a udf? partitoned tables?

    Thanks
    Shilpa

    Reply
    • Venkat Reddy.ravu
      April 28, 2010 1:28 pm

      Hi Shilpa,

      Data integrity simply means the quality of data in the database.It is useful to keep the data unchanged and unique.Data integrity can be described in following scenarious

      •Entity integrity
      •Domain integrity
      •Referential integrity
      •User-defined integrity

      https://www.microsoft.com/en-us/download/details.aspx?id=51958

      Partioned tables also best describable for data integrity and data management in the database.Parttioned tables help to keep certain set set of records to maintain as per our requirement.

      Reply
  • Anant Anand Gupta
    January 7, 2009 7:50 pm

    Thanks a lot!!

    Reply
  • Shilpa –

    Data Integrity:
    This is many things to many people. It simply means the data you have stored in various tables can be trusted and is of high quality. How the trust can be defined is up to you – but basically it can be quantified as:

    Entity integrity means the presence of a unique row identifier, like Item_id which cannot be duplicated.

    Domain integrity – a range of values are allowed. Nothing more, nothing less.

    Referential integrity – establishing foreign keys will help you here.

    and

    User defined integrity – well, you define it.

    UDF – is a user defined function, used to quickly (well depending on the quality of sql) do inline calculations/lookups inside a select statement. For example, you can write a udf that would check whether an Item number is valid, before you do any operations on it.

    Partitioned tables comes in handy when dealing with high volume tables. You take Table A that has say 25 million records with 5 million each for each of last five years and split them into TableA_2008 (that contains only 2008 data), TableA_@2007, TableA_2006 etc with proper indexes (there are some more details involved here that I am going to omit) etc, then create a view that will be called Table A that would be union of those 5 partitioned tables.

    When properly implemented, the performance gains are incredible, especially for reporting in Business Intelligence applications.

    Hope this helps.

    Reply
    • Hi Anil Pillai,
      Can you please tell me what is the max number of rows we can transfer a a time from OLTP to OLAP system.

      Reply
      • Hello Jay,

        Are you facing some issue in transfering rows from OLTP to OLAP? In SQL Server there is no constraint on number of rows processed by a statement.

        Regards,
        Pinal Dave

      • I wonder if SQL Server at different organizations has limitations imposed by the hardware on which SQL Server is installed or the policies of an an organization. For example, I believe some SQL Server operations may fail with large data sets because temporary space is exhausted. Is this consistent with your experience and understanding?

        BTW, thank you for your blog. You are a special author because of your deep understanding of SQL Server technical topics as well as the clear and concise way that you communicate about those topics.

  • Hi Pinal Dave,

    Your contribution to this world of SQL DBA`s are really appreciated.

    Thanks much for all the info.

    Thank You,
    Anup

    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
    • Hi

      your taking about Database or in Table if you want table structure then please go through below mentioned ex.

      select * into [server name].database name.dbo.table name from [server name].database name.dbo.table name

      and if you want database contain then go Attached and Deattachment and log shipping.

      Reply
    • select * into server2.db2.tb2 from server1.db1.tb1

      Reply

Leave a Reply