• Home
  • Resume
  • All Articles
  • SQL Interview Q & A
  • Contact Me

Journey to SQL Authority with Pinal Dave

Notes of a SQL Server MVP and Database Administrator

Feeds:
Posts
Comments

SQL Server Interview Questions and Answers – Part 2

April 16, 2007 by pinaldave

UPDATE : Interview Questions and Answers are now updated with SQL Server 2008 Questions and its answers. New Location : SQL Server 2008 Interview Questions and Answers.

What is the difference between clustered and a non-clustered index?
A clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore table can have only one clustered index. The leaf nodes of a clustered index contain the data pages.

A nonclustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk. The leaf node of a nonclustered index does not consist of the data pages. Instead, the leaf nodes contain index rows.

What are the different index configurations a table can have?
A table can have one of the following index configurations:

No indexes
A clustered index
A clustered index and many nonclustered indexes
A nonclustered index
Many nonclustered indexes

What is cursors?
Cursor is a database object used by applications to manipulate data in a set on a row-by-row basis, instead of the typical SQL commands that operate on all the rows in the set at one time.

In order to work with a cursor we need to perform some steps in the following order:

Declare cursor
Open cursor
Fetch row from the cursor
Process fetched row
Close cursor
Deallocate cursor

What is the use of DBCC commands?
DBCC stands for database consistency checker. We use these commands to check the consistency of the databases, i.e., maintenance, validation task and status checks.
E.g. DBCC CHECKDB – Ensures that tables in the db and the indexes are correctly linked.
DBCC CHECKALLOC – To check that all pages in a db are correctly allocated.
DBCC CHECKFILEGROUP – Checks all tables file group for any damage.

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.
Storped Procedure sp_addlinkedserver, sp_addlinkedsrvlogin will be used add new Linked Server.

What is Collation?
Collation refers to a set of rules that determine how data is sorted and compared. Character data is sorted using rules that define the correct character sequence, with options for specifying case-sensitivity, accent marks, kana character types and character width.

What are different type of Collation Sensitivity?
Case sensitivity
A and a, B and b, etc.

Accent sensitivity
a and á, o and ó, etc.

Kana Sensitivity
When Japanese kana characters Hiragana and Katakana are treated differently, it is called Kana sensitive.

Width sensitivity
When a single-byte character (half-width) and the same character when represented as a double-byte character (full-width) are treated differently then it is width sensitive.

What’s the difference between a primary key and a unique key?
Both primary key and unique enforce uniqueness of the column on which they are defined. But by default primary key creates a clustered index on the column, where are unique creates a nonclustered index by default. Another major difference is that, primary key doesn’t allow NULLs, but unique key allows one NULL only.

How to implement one-to-one, one-to-many and many-to-many relationships while designing tables?
One-to-One relationship can be implemented as a single table and rarely as two tables with primary and foreign key relationships.
One-to-Many relationships are implemented by splitting the data into two tables with primary key and foreign key relationships.
Many-to-Many relationships are implemented using a junction table with the keys from both the tables forming the composite primary key of the junction table.

Complete Series of SQL Server Interview Questions and Answers
SQL Server Interview Questions and Answers – Introduction
SQL Server Interview Questions and Answers – Part 1
SQL Server Interview Questions and Answers – Part 2
SQL Server Interview Questions and Answers – Part 3
SQL Server Interview Questions and Answers – Part 4
SQL Server Interview Questions and Answers – Part 5
SQL Server Interview Questions and Answers – Part 6
SQL Server Interview Questions and Answers Complete List Download

Reference : Pinal Dave (http://blog.SQLAuthority.com)


Posted in Database, Pinal Dave, SQL, SQL Authority, SQL Constraint and Keys, SQL Cursor, SQL Download, SQL Index, SQL Interview Questions and Answers, SQL Joins, SQL Performance, SQL Query, SQL Scripts, SQL Security, SQL Server, SQL Server DBCC, SQL Tips and Tricks, SQL Trigger, Software Development, T SQL, Technology | Tagged SQL Collation | 54 Comments

54 Responses

  1. on June 27, 2007 at 11:10 pm Sudha

    It si really good


  2. on July 9, 2007 at 11:49 pm praveen

    its superb , but add some more interview tips and faq


  3. on July 18, 2007 at 12:08 pm Mohan

    It’s really superb


  4. on July 20, 2007 at 2:34 am Mallika

    Answers provided are really clear and concise.


  5. on August 1, 2007 at 5:36 am kumar

    Hi Dave,
    its very easy to understand the topics.

    Thanks


  6. on August 8, 2007 at 6:57 am veena

    ohhhhhhhhhhh!!!!!!!!!!!
    wow!!!!!!!
    fantastic!!!!!!!lovely………..
    so easy and simple…………
    thanks a lot…..
    can u give questions for vb etc……..


  7. on August 23, 2007 at 11:19 pm Prasad

    Hi Dave,
    its simple to understand.

    many thanks ……………..


  8. on September 6, 2007 at 9:53 pm RAM PRASAD

    It’s Awesome …

    It’s really helpful…

    It has useful stuff…

    Thanks…


  9. on September 7, 2007 at 4:10 am Manoj

    Hi,

    Itz really usefull and very simple defined.


  10. on September 18, 2007 at 10:23 pm Vimal Naik

    Dave,

    Its really nice.

    Can we have some advanced questions and answers added into this series. like fetching the ntext column etc


  11. on October 13, 2007 at 1:36 am Raj

    It’s good….


  12. on October 22, 2007 at 12:38 am deepak

    excelent but it sholud contain some
    realtime related question and answer


  13. on October 23, 2007 at 10:44 pm Pratibha

    very nice…
    easy to read and often asked
    can u give some complicated sql queries example
    Thanks


  14. on October 30, 2007 at 11:06 pm HARI

    Really this is a good stuff for beginners and medium level Developers to brush up the SQL knowledge


  15. on October 30, 2007 at 11:08 pm HARI

    Need help how to create and maintain dynamic databases
    for web applications


  16. on November 5, 2007 at 9:06 pm Rahber

    Realy very very goog and help full for interviews …


  17. on November 17, 2007 at 3:19 am A

    DBCC may stand for the following …

    DBCC Database Concurrency Control
    DBCC Database Consistency Check
    DBCC Database Console Command


  18. on January 16, 2008 at 1:06 pm priya

    its very simple to understand…..thank u


  19. on January 24, 2008 at 9:18 am Anwar

    its nice and superb.ainclude some logical question for sql dba.


  20. on January 25, 2008 at 12:29 pm naresh

    its good and easy to understand…provide some other questions about sql dba..


  21. on January 25, 2008 at 12:30 pm naresh

    its good…


  22. on February 3, 2008 at 1:42 am Your Reader

    Its very good and easy to understand. It would be great if you add examples to the topics..like for normalization ..some table and breaking down that into multiple tables by navigating through normalization rules… For Joins : one example


  23. on February 5, 2008 at 5:01 pm Santanu

    Hi Dev,

    It is very fantastick Q&A. But I want to know How connect to the SqlServer to C++. PLZ send me code.

    Thanks


  24. on February 5, 2008 at 5:08 pm Santanu

    It is very fantastick Q&A. But I want to know How connect to the SqlServer to C++. PLZ send me code.

    Thanks


  25. on February 16, 2008 at 6:21 pm Arulraj

    Hi

    It is very easy to understad the Q & A


  26. on February 18, 2008 at 9:55 am Vinay.R

    halo sir,

    So helpful material on the occasion of interviews.Thanks


  27. on March 5, 2008 at 8:33 pm Alexis

    It’s so helpfull!! Thanks . But I think if you would translate this blog to spanish a lot of people in Latin America will be so glad. I hope you listen my request.

    sorry for bad English


  28. on March 10, 2008 at 5:01 pm Faisal Qureshi

    Nice Link


  29. on March 11, 2008 at 3:17 pm Tarun

    Thanks a lot its Really gr8


  30. on March 19, 2008 at 7:41 am saravana

    Who!!!!! Its really superb!!!!!! Its very intresting things and easy to understand.

    And it will be help full for Job seekers….PLease add more question so that we can no more information..


  31. on March 28, 2008 at 6:30 am aruna

    hi,

    its really superb.very clear.

    thanks
    aruna


  32. on March 28, 2008 at 9:34 am sanika

    Its great stuff…simple to understand…keep it up!!!


  33. on April 8, 2008 at 5:07 pm Manoj

    It’s really gud sir….


  34. on April 11, 2008 at 1:04 am Imran

    @ Dave

    I am not sure if Cursor is a database objects, can we call cursor a datatype.


  35. on April 29, 2008 at 3:31 am paras

    Good snapshot!


  36. on April 30, 2008 at 5:35 pm Joe

    Very Nice !!!


  37. on May 3, 2008 at 4:59 pm ravi

    its good but sm practical example should be thr.Everything is in theory.not much helpful in implementation.smthing like
    when to use this concept should be there.


  38. on May 7, 2008 at 9:37 pm Kanchan Gupta

    good helping approach to candidates


  39. on May 8, 2008 at 11:18 pm Prashanthi G

    Its Good,it is very advantage to us


  40. on May 10, 2008 at 6:34 pm Kavitha

    Hi

    Really very usefull for interviews .This is very nice .


  41. on May 16, 2008 at 10:44 am Michael

    Excellent!!!!!


  42. on May 28, 2008 at 5:44 am prahadhir

    Gr8 work man…

    appreciated…

    Thank u so much


  43. on June 14, 2008 at 3:40 pm shafi

    its nice
    but answer the questions in broadway
    means please answer them in efficient& globalway
    thank you


  44. on June 21, 2008 at 1:33 am shravs

    hi Pinal,
    This site is very helpful…am a begginner to SQL server…thank you for posting the interview questions…could you please mail me all the interview questions…and any useful books for the begginers…

    Thank You


  45. on June 24, 2008 at 12:44 pm MIS

    i see many nice and greate quastions but i cant see any answers while they said nice naswer how can i see the answer’s
    so every one can share the nice and greate info.

    best regards


  46. on July 16, 2008 at 8:03 pm ash

    hey pinal,

    all the questions were answers with simplicity better than even wikipedia…. thanks a lot man….


  47. on July 18, 2008 at 7:54 pm Rajiv

    Hey Pinal,

    This is really helpful.. And the way you arranged the questions and answers are simply superb…


  48. on July 30, 2008 at 10:31 am Abid

    Hey Pinal

    Realy valueable material. thanks


  49. on August 7, 2008 at 2:00 pm Mohan

    hi all
    How to escape special character when using query like update and insert queries???

    Thanks in Advance
    Mohan


  50. on August 21, 2008 at 7:56 pm romit

    it is very simple language to learn


  51. on August 31, 2008 at 1:28 pm SATYA

    HI

    I WANT TO CALLICULATE THE DATE OF BIRTH LIKE 19 YEARS 4 MONTHS 2 DAYS
    CAN U SUGGEST ME A QUERY
    HOU CAN I CONSIDER THE LEAP YEARS


  52. on September 8, 2008 at 11:49 am Bhajharam prasad dhyani

    very nice!


  53. on September 20, 2008 at 11:36 am pinaldave

    UPDATE : Interview Questions and Answers are now updated with SQL Server 2008 Questions and its answers. New Location : SQL Server 2008 Interview Questions and Answers.

    Please continue with your questions and answers at new location.


  54. on February 24, 2009 at 6:22 pm SQL SERVER - Database Interview Questions and Answers Complete List Journey to SQL Authority with Pinal Dave

    [...] Interview Questions and Answers – Introduction SQL Server Interview Questions and Answers – Part 1 SQL Server Interview Questions and Answers – Part 2 SQL Server Interview Questions and Answers – Part 3 SQL Server Interview Questions and Answers – [...]



Comments are closed.

  • Search
  • About Pinal Dave

    Pinalkumar Dave is a Microsoft SQL Server MVP and a Mentor for Solid Quality India. He has written over 1100 articles on the subject on his blog at http://blog.sqlauthority.com. He is a dynamic and proficient Principal Database Architect, Corporate Trainer and Project Manager, who specializes in SQL Server Programming and has 7 years of hands-on experience. He holds a Masters of Science degree and a number of certifications, including MCDBA and MCAD (.NET). He was awarded Regional Mentor for PASS Asia.


    LinkedIn - Pinal Dave Twitter - Pinal Dave facebook
    Feed Email

  • Blog Stats

    • 10,888,744 Readers
  • SQLAuthority Links


    My Homepage
    My Resume
    My Other Blog
           --------------------
    Top Downloads
       PDF Downloads
       Script Downloads

    Script Bank
       Favorite Scripts
       All Scripts - 1
       All Scripts - 2

    Top Articles
       Best Articles
       Favorite Articles - 1
       Favorite Articles - 2
           --------------------
    SQL Interview Q & A
    SQL Coding Standards
    SQL FAQ Download
           --------------------
    Jobs @ SQLAuthority
    Bookmark and Share
    AddThis Feed Button
  • Top 7 Commenters

      357 - Imran Mohammed
      135- Brian Tkatch
       55 - Tejas Shah
       54 - Jacob Sebastian
       47 - Jerry Hung
       46 - Kuldip Bhatt
       42 - Ashish Gilhotra
  • Categories

    • About Me (61)
    • Best Practices (91)
    • Business Intelligence (14)
    • Data Warehousing (30)
    • Database (269)
    • DBA (125)
    • MVP (98)
    • Poll (5)
    • Readers Contribution (37)
    • Readers Question (44)
    • Software Development (67)
    • SQL Add-On (91)
    • SQL Backup and Restore (54)
    • SQL BOL (10)
    • SQL Coding Standards (20)
    • SQL Constraint and Keys (51)
    • SQL Cursor (28)
    • SQL Data Storage (45)
    • SQL DateTime (37)
    • SQL Documentation (219)
    • SQL Download (222)
    • SQL Error Messages (125)
    • SQL Function (124)
    • SQL Humor (25)
    • SQL Index (97)
    • SQL Interview Questions and Answers (58)
    • SQL Joins (63)
    • SQL Optimization (66)
    • SQL Performance (222)
    • SQL Puzzle (25)
    • SQL Security (119)
    • SQL Server DBCC (42)
    • SQL Server Management Studio (28)
    • SQL Stored Procedure (101)
    • SQL String (19)
    • SQL System Table (50)
    • SQL Trigger (24)
    • SQL User Group (48)
    • SQL Utility (126)
    • SQL White Papers (37)
    • SQLAuthority (374)
      • SQL Training (1)
      • SQLAuthority Author Visit (80)
      • SQLAuthority Book Review (18)
      • SQLAuthority News (344)
      • SQLAuthority Website Review (29)
    • SQLServer (75)
    • Tech (912)
      • Pinal Dave (902)
      • SQL Scripts (531)
    • Technology (1155)
      • SQL (1155)
      • SQL Authority (1155)
      • SQL Query (1155)
      • SQL Server (1155)
      • SQL Tips and Tricks (1155)
      • T SQL (1155)
  • Top Posts

    • SQL SERVER - Insert Data From One Table to Another Table - INSERT INTO SELECT - SELECT INTO TABLE
    • SQL SERVER - Insert Multiple Records Using One Insert Statement - Use of UNION ALL
    • SQL SERVER - Import CSV File Into SQL Server Using Bulk Insert - Load Comma Delimited File Into SQL Server
    • SQL SERVER - Retrieve Current Date Time in SQL Server CURRENT_TIMESTAMP, GETDATE(), {fn NOW()}
    • SQL Server Interview Questions and Answers Complete List Download
    • SQL SERVER - Convert Text to Numbers (Integer) - CAST and CONVERT
    • SQL SERVER - 2005 - Create Script to Copy Database Schema and All The Objects - Stored Procedure, Functions, Triggers, Tables, Views, Constraints and All Other Database Objects
    • SQL SERVER - Shrinking Truncate Log File - Log Full
    • SQL SERVER - 2008 - Interview Questions and Answers Complete List Download
    • SQL SERVER - Restore Database Backup using SQL Script (T-SQL)
    • SQL SERVER - 2005 List All Tables of Database
    • SQL Server Interview Questions and Answers - Part 1
  • Authors

    • pinaldave
      • SQL SERVER – 2005 2008 – Backup, Integrity Check and Index Optimization By Ola Hallengren
      • SQLAuthority News – Notes of Excellent Experience at SQL PASS 2009 Summit, Seattle
      • SQL SERVER – Whitepaper Consolidation Using SQL Server 2008
      • SQLAuthority News – Disk Partition Alignment Best Practices for SQL Server
      • SQL SERVER – Policy Based Management – Create, Evaluate and Fix Policies
      • SQL SERVER – Disable CHECK Constraint – Enable CHECK Constraint
      • SQL SERVER – Sharepoint Resource Available for SQL Server
      • SQL Authority News – Training MS SQL Server 2005/2008 Query Optimization And Performance Tuning
      • SQL SERVER – Removing Key Lookup – Seek Predicate – Predicate – An Interesting Observation Related to Datatypes
      • SQL SERVER – Stored Procedure are Compiled on First Run – SP taking Longer to Run First Time
  • Archives

    • November 2009
    • October 2009
    • September 2009
    • August 2009
    • July 2009
    • June 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
    • October 2008
    • September 2008
    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
    • March 2008
    • February 2008
    • January 2008
    • December 2007
    • November 2007
    • October 2007
    • September 2007
    • August 2007
    • July 2007
    • June 2007
    • May 2007
    • April 2007
    • March 2007
    • February 2007
    • January 2007
    • December 2006
    • November 2006
  • Pages

    • Resume
    • All Articles
    • SQL Interview Q & A
    • Contact Me
      • googledceeba0da7ad381a.html
      • Copyright
      • Contact Me – Archive 1
      • Contact Me – Archive 2
      • Contact Me – Archive 3
  • Category Cloud

    About Me Best Practices Database DBA MVP Pinal Dave Software Development SQL SQL Add-On SQL Authority SQLAuthority Author Visit SQLAuthority News SQL Documentation SQL Download SQL Error Messages SQL Function SQL Index SQL Joins SQL Optimization SQL Performance SQL Query SQL Scripts SQL Security SQLServer SQL Server SQL Stored Procedure SQL Tips and Tricks SQL Utility Technology T SQL
  •  

    April 2007
    M T W T F S S
    « Mar   May »
     1
    2345678
    9101112131415
    16171819202122
    23242526272829
    30  
  • Add to Technorati Favorites
    Software blogs Blogarama - The Blog Directory
    Technology blogs Programming Blogs - BlogCatalog Blog Directory TopOfBlogs
    Blog Directory
    Visit blogadda.com to discover Indian blogs
    Page copy protected against web site content infringement by Copyscape

Blog at WordPress.com.

Theme: Mistylook by Sadish.