SlideShare a Scribd company logo
1 of 19
SQL Server interview questions




Explain the use of keyword WITH ENCRYPTION. Create a Store Procedure
with Encryption.


It is a way to convert the original text of the stored procedure into encrypted form.
The stored procedure gets obfuscated and the output of this is not visible to


CREATE PROCEDURE Abc
WITH ENCRYPTION
AS
<<   SELECT statement>>
GO



What is a linked server in SQL Server?


It enables SQL server to address diverse data sources like OLE DB similarly. It
allows Remote server access and has the ability to issue distributed queries,
updates, commands and transactions.




Features and concepts of Analysis Services


Analysis Services is a middle tier server for analytical processing, OLAP, and Data
mining. It manages multidimensional cubes of data and provides access to heaps of
information including aggregation of data One can create data mining models from
data sources and use it for Business Intelligence also including reporting features.
Some of the key features are:
   • Ease of use with a lot of wizards and designers.
   • Flexible data model creation and management
   • Scalable architecture to handle OLAP
   • Provides integration of administration tools, data sources, security, caching,
      and reporting etc.
   • Provides extensive support for custom applications




What is Analysis service repository?


Every Analysis server has a repository to store metadata for the objects like cubes,
data sources etc. It’s by default stored in a MS Access database which can be also
migrated to a SQL Server database.




What is SQL service broker?


Service Broker allows internal and external processes to send and receive
guaranteed, asynchronous messaging. Messages can also be sent to remote servers
hosting databases as well. The concept of queues is used by the broker to put a
message in a queue and continue with other applications asynchronously. This
enables client applications to process messages at their leisure without blocking the
broker. Service Broker uses the concepts of message ordering, coordination,
multithreading and receiver management to solve some major message queuing
problems. It allows for loosely coupled services, for database applications.




What is user defined datatypes and when you should go for them?


User defined data types are based on system data types. They should be used when
multiple tables need to store the same type of data in a column and you need to
ensure that all these columns are exactly the same including length, and nullability.
Parameters for user defined datatype:
Name
System data type on which user defined data type is based upon.
Nullability.
For example, a user-defined data type called post_code could be created based on
char system data type.




What is bit datatype?


A bit datatype is an integer data type which can store either a 0 or 1 or null value.




Describe the XML support SQL server extends.

SQL Server (server-side) supports 3 major elements:

   a. Creation of XML fragments: This is done from the relational data using
       FOR XML to the select query.
b. Ability to shred xml data to be stored in the database.
   c. Finally, storing the xml data.

Client-side XML support in SQL Server is in the form of SQLXML. It can be
described in terms of

   •   XML Views: providing bidirectional mapping between XML schemas and
       relational tables.
   •   Creation of XML Templates: allows creation of dynamic sections in
       XML.




What is SQL Server English Query?


English query allows accessing the relational databases through English Query
applications. Such applications permit the users to ask the database to fetch data
based on simple English instead of using SQL statements.




What is the purpose of SQL Profiler in SQL server?


SQL profiler is a tool to monitor performance of various stored procedures. It is
used to debug the queries and procedures. Based on performance, it identifies the
slow executing queries. Capture any problems by capturing the events on
production environment so that they can be solved.
What is XPath?


XPath is an expressions to select a xml node in an XML document.
It allows the navigation on the XML document to the straight to the element where
we need to reach and access the attributes.




What are the Authentication Modes in SQL Server?


   a.   Windows Authentication Mode (Windows Authentication): uses user’s
        Windows account
   b.   Mixed Mode (Windows Authentication and SQL Server Authentication):
        uses either windows or SQL server




Explain Data Definition Language, Data Control Language and Data
Manipulation Language.
Data Definition Language (DDL):- are the SQL statements that define the database
structure.
Example:

        a.   CREATE
        b.   ALTER
        c.   DROP
        d.   TRUNCATE
        e.   COMMENT
        f.   RENAME
Data Manipulation Language (DML):- statements are used for manipulate or edit
data.
Example:

        a.   SELECT - retrieve data from the a database
        b.   INSERT - insert data into a table
        c.   UPDATE - updates existing data within a table
        d.   DELETE
        e.   MERGE
        f.   CALL
        g.   EXPLAIN PLAN
        h.   LOCK TABLE

Data Control Language (DCL):-statements to take care of the security and
authorization.

Examples:

   a.   GRANT
   b.   REVOKE



What are the steps to process a single SELECT statement?
Steps


   a. The select statement is broken into logical units
   b. A sequence tree is built based on the keywords and expressions in the form
        of the logical units.
c. Query optimizer checks for various permutations and combinations to figure
      out the fastest way using minimum resources to access the source tables.
      The best found way is called as an execution plan.
   d. Relational engine executes the plan and processes the data




Explain GO Command.


Go command is a signal to execute the entire batch of SQL statements after
previous Go.


What is the significance of NULL value and why should we avoid permitting
null values?


NULL value means that no entry has been made into the column. It states that the
corresponding value is either unknown or undefined. It is different from zero or "".
They should be avoided to avoid the complexity in select & update queries and
also because columns which have constraints like primary or foreign key
constraints cannot contain a NULL value.


What is the difference between UNION and UNION ALL?


UNION selects only distinct values whereas UNION ALL selects all values and
not just distinct ones.
UNION:           SELECT          column_names           FROM           table_name1
UNION
SELECT column_names FROM table_name2
UNION        All:     SELECT        column_names       FROM          table_name1
UNION                                                                      ALL
SELECT column_names FROM table_name2




What is use of DBCC Commands?


DBCC (Database consistency checker) act as Database console commands for
SQL Server to check database consistency. They are grouped as:
Maintenance: Maintenance tasks on Db, filegroup, index etc. Commands include
DBCC CLEANTABLE, DBCC INDEXDEFRAG, DBCC DBREINDEX, DBCC
SHRINKDATABASE, DBCC DROPCLEANBUFFERS, DBCC SHRINKFILE,
DBCC FREEPROCCACHE, and DBCC UPDATEUSAGE.
Miscellaneous: Tasks such as enabling tracing, removing dll from memory.
Commands       include     DBCC       dllname,     DBCC          HELP,    DBCC
FREESESSIONCACHE, DBCC TRACEOFF, DBCC FREESYSTEMCACHE,
and DBCC TRACEON.
Informational: Tasks which gather and display various types of information.
Commands include DBCC INPUTBUFFER, DBCC SHOWCONTIG, DBCC
OPENTRAN,       DBCC      SQLPERF,       DBCC      OUTPUTBUFFER,          DBCC
TRACESTATUS, DBCC PROCCACHE, DBCC USEROPTIONS, and DBCC
SHOW_STATISTICS.
Validation: Operations for validating on Db, index, table etc. Commands include
DBCC        CHECKALLOC,           DBCC        CHECKFILEGROUP,             DBCC
CHECKCATALOG, DBCC CHECKIDENT, DBCC CHECKCONSTRAINTS,
DBCC CHECKTABLE, and DBCC CHECKDB.
What is Log Shipping?


Log shipping defines the process for automatically taking backup of the database
and transaction files on a SQL Server and then restoring them on a standby/backup
server. This keeps the two SQL Server instances in sync with each other. In case
production server fails, users simply need to be pointed to the standby/backup
server. Log shipping primarily consists of 3 operations:
Backup transaction logs of the Production server.
Copy these logs on the standby/backup server.
Restore the log on standby/backup server.




What is the difference between a Local and a Global temporary table?


Temporary tables are used to allow short term use of data in SQL Server. They are
of 2 types:
Local                                       Global
Only available to the current Db            Available to any connection once
connection for current user and are         created. They are cleared when the last
cleared when connection is closed.          connection is closed.
Multiple users can’t share a local          Can be shared by multiple user sessions.
temporary table.



What is the STUFF and how does it differ from the REPLACE function?
Both STUFF and REPLACE are used to replace characters in a string.


select replace('abcdef','ab','xx') results in xxcdef


select replace('defdefdef','def','abc') results in abcabcabc
We cannot replace a specific occurrence of “def” using REPLACE.


select stuff('defdefdef',4, 3,'abc') results in defabcdef


where 4 is the character to begin replace from and 3 is the number of characters to
replace.




What are the rules to use the ROWGUIDCOL property to define a globally
unique identifier column?


Only one column can exist per table that is attached with ROWGUIDCOL
property. One can then use $ROWGUID instead of column name in select list.




What is the actions prevented once referential integrity is enforced?


Actions prevented are:
   • Breaking of relationships is prevented once referential integrity on a
      database is enforced.
   • Can’t delete a row from primary table if there are related rows in secondary
      table.
• Can’t update primary table’s primary key if row being modified has related
      rows in secondary table.
  • Can’t insert a new row in secondary table if there are not related rows in
      primary table.
  • Can’t update secondary table’s foreign key if there is no related row in
      primary table.




What are the commands available for Summarizing Data in SQL Server?


Commands for summarizing data in SQL Server:
Command                    Description                  Syntax/Example
SUM                        Sums related values          SELECT SUM(Sal) as
                                                        Tot from Table1;
AVG                        Average value                SELECT AVG(Sal) as
                                                        Avg_Sal from Table1;
COUNT                      Returns number of rows       SELECT COUNT(*)
                           of resultset                 from Table1;
MAX                        Returns max value from a     SELECT MAX(Sal) from
                           resultset                    Table1;
MIN                        Returns min value from a     SELECT MIN(Sal) from
                           resultset                    Table1;
GROUP BY                   Arrange resultset in         SELECT ZIP,City FROM
                           groups                       Emp GROUP BY ZIP
ORDER BY                   Sort resultset               SELECT ZIP,City FROM
                                                        Emp ORDER BY City



List out the difference between CUBE operator and ROLLUP operator
Difference between CUBE and ROLLUP:
CUBE                                       ROLLUP
It’s an additional switch to GROUP BY      It’s an extension to GROUP BY clause.
clause. It can be applied to all           It’s used to extract statistical and
aggregation functions to return cross      summarized information from result
tabular result sets. .                     sets. It creates groupings and then
                                           applies aggregation functions on them.
Produces all possible combinations of      Produces only some possible subtotal
subtotals specified in GROUP BY            combinations.
clause and a Grand Total.



What are the guidelines to use bulk copy utility of SQL Server?


Bulk copy is an API that allows interacting with SQL Server to export/import data
in one of the two data formats. Bulk copy needs sufficient system credentials.
   • Need INSERT permissions on destination table while importing.
   • Need SELECT permissions on source table while exporting.
   • Need SELECT permissions on sysindexes, sysobjects and syscolumns
       tables.
   bcp.exe northwind..cust out "c:cust.txt" –c -T
   Export all rows in Northwind.Cust table to an ASCII-character formatted text
   file.




What are the capabilities of Cursors?
Capabilities of cursors:
   • Cursor reads every row one by one.
   • Cursors can be used to update a set of rows or a single specific row in a
      resultset
   • Cursors can be positioned to specific rows.
   • Cursors can be parameterized and hence are flexible.
   • Cursors lock row(s) while updating them.




What are the ways to controlling Cursor Behavior?


There are 2 ways to control Cursor behavior:
   • Cursor Types: Data access behavior depends on the type of cursor; forward
      only, static, keyset-drive and dynamic.
   • Cursor behaviors: Keywords such as SCROLL and INSENSITIVE along
      with the Cursor declaration define scrollability and sensitivity of the cursor.




What are the advantages of using Stored Procedures?
Advantages of using stored procedures are:
   • They are easier to maintain and troubleshoot as they are modular.
   • Stored procedures enable better tuning for performance.
   • Using stored procedures is much easier from a GUI end than building/using
      complex queries.
• They can be part of a separate layer which allows separating the concerns.
      Hence Database layer can be handled by separate developers proficient in
      database queries.
   • Help in reducing network usage.
   • Provides more scalability to an application.
   • Reusable and hence reduce code.




What are the ways to code efficient transactions?


Some ways and guidelines to code efficient transactions:
   • Do not ask for an input from a user during a transaction.
   • Get all input needed for a transaction before starting the transaction.
   • Transaction should be atomic
   • Transactions should be as short and small as possible.
   • Rollback a transaction if a user intervenes and re-starts the transaction.
   • Transaction should involve a small amount of data as it needs to lock the
      number of rows involved.
   • Avoid transactions while browsing through data.




What are the differences among batches, stored procedures, and triggers?


Batch                       Stored Procedure               Triggers
Collection or group of      It’s a collection or group     It’s a type of Stored
SQL statements. All         of SQL statements that’s       procedure that cannot be
statements of a batch are       compiled once but used   called directly. Instead it
compiled into one               many times.              fires when a row is
executional unit called                                  updated, deleted, or
execution plan. All                                      inserted.
statements are then
executed statement by
statement.



What security features are available for stored procedures?


Security features for stored procedures:
   • Grants users permissions to execute a stored procedure irrespective of the
      related tables.
   • Grant users users permission to work with a stored procedure to access a
      restricted set of data yet no give them permissions to update or select
      underlying data.
   • Stored procedures can be granted execute permissions rather than setting
      permissions on data itself.
   • Provide more granular security control through stored procedures rather than
      complete control on underlying data in tables.
What are the instances when triggers are appropriate?


Scenarios for using triggers:
   • To create a audit log of database activity.
   • To apply business rules.
   • To apply some calculation on data from tables which is not stored in them.
• To enforce referential integrity.
   • Alter data in a third party application
   • To execute SQL statements as a result of an event/condition automatically.




What are the restrictions applicable while creating views?


Restrictions applicable while creating views:
   • A view cannot be indexed.
   • A view cannot be Altered or renamed. Its columns cannot be renamed.
   • To alter a view, it must be dropped and re-created.
   • ANSI_NULLS and QUOTED_IDENTIFIER options should be turned on to
      create a view.
   • All tables referenced in a view must be part of the same database.
   • Any user defined functions referenced in a view must be created with
      SCHEMABINDING option.
   • Cannot use ROWSET, UNION, TOP, ORDER BY, DISTINCT,
      COUNT(*), COMPUTE, COMPUTE BY in views.


What are the events recorded in a transaction log?


Events recorded in a transaction log:
   • Broker event category includes events produced by Service Broker.
   • Cursors event category includes cursor operations events.
   • CLR event category includes events fired by .Net CLR objects.
• Database event category includes events of data.log files shrinking or
    growing on their own.
• Errors and Warning           event category includes SQL Server warnings and
    errors.
• Full text event category include events occurred when text searches are
    started, interrupted, or stopped.
• Locks event category includes events caused when a lock is acquired,
    released, or cancelled.
• Object event category includes events of database objects being created,
    updated or deleted.
•   OLEDB event category includes events caused by OLEDB calls.
• Performance event category includes events caused by DML operators.
• Progress report event category includes Online index operation events.
• Scans event category includes events notifying table/index scanning.
• Security audit event category includes audit server activities.
• Server event category includes server events.
• Sessions event category includes connecting and disconnecting events of
    clients to SQL Server.
• Stored procedures event category includes events of execution of Stored
    procedures.
• Transactions event category includes events related to transactions.
• TSQL event category includes events generated while executing TSQL
    statements.
• User configurable event category includes user defined events.
Describe when checkpoints are created in a transaction log.


Activities causing checkpoints are:
   • When a checkpoint is explicitly executed.
   • A logged operation is performed on the database.
   • Database files have been altered using Alter Database command.
   • SQL Server has been stopped explicitly or on its own.
   • SQL Server periodically generates checkpoints.
   • Backup of a database is taken.




Define Truncate and Delete commands.


TRUNCATE                               DELETE
This is also a logged operation but in This is a logged operation for every row.
terms of deallocation of data pages.
Cannot TRUNCATE a table that has Any row not violating a constraint can
foreign key constraints.              be Deleted.
Resets identity column to the default Does not reset the identity column.
starting value.                         Starts where it left from last.
Removes all rows from a table.          Used delete all or selected rows from a
                                        table based on WHERE clause.
Cannot be Rolled back.                  Need to Commit or Rollback
DDL command                             DML command
For more questions with answers, follow the link below:

http://www.careerride.com/SQLServer-Interview-Questions.aspx



We do not warrant the correctness of content. The risk from using it lies entirely
with the user. While using this document, you agree to have read and accepted the
terms of use and privacy policy.

More Related Content

What's hot

Doctrine 2 - Introduction
Doctrine 2 - IntroductionDoctrine 2 - Introduction
Doctrine 2 - IntroductionDiego Lewin
 
What is SQL Server?
What is SQL Server?What is SQL Server?
What is SQL Server?CPD INDIA
 
Intro to T-SQL - 1st session
Intro to T-SQL - 1st sessionIntro to T-SQL - 1st session
Intro to T-SQL - 1st sessionMedhat Dawoud
 
PostgreSQL Tutorial For Beginners | Edureka
PostgreSQL Tutorial For Beginners | EdurekaPostgreSQL Tutorial For Beginners | Edureka
PostgreSQL Tutorial For Beginners | EdurekaEdureka!
 
Types of sql commands by naveen kumar veligeti
Types of sql commands by naveen kumar veligetiTypes of sql commands by naveen kumar veligeti
Types of sql commands by naveen kumar veligetiNaveen Kumar Veligeti
 
Database Systems - Introduction to SQL (Chapter 3/1)
Database Systems - Introduction to SQL (Chapter 3/1)Database Systems - Introduction to SQL (Chapter 3/1)
Database Systems - Introduction to SQL (Chapter 3/1)Vidyasagar Mundroy
 
Database Programming Techniques
Database Programming TechniquesDatabase Programming Techniques
Database Programming TechniquesRaji Ghawi
 
Introduction to SQL, SQL*Plus
Introduction to SQL, SQL*PlusIntroduction to SQL, SQL*Plus
Introduction to SQL, SQL*PlusChhom Karath
 
Database Programming
Database ProgrammingDatabase Programming
Database ProgrammingHenry Osborne
 
Introduction to JDBC and database access in web applications
Introduction to JDBC and database access in web applicationsIntroduction to JDBC and database access in web applications
Introduction to JDBC and database access in web applicationsFulvio Corno
 
Sql a practical introduction
Sql   a practical introductionSql   a practical introduction
Sql a practical introductionHasan Kata
 

What's hot (20)

Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
 
SQL commands
SQL commandsSQL commands
SQL commands
 
Sql server T-sql basics ppt-3
Sql server T-sql basics  ppt-3Sql server T-sql basics  ppt-3
Sql server T-sql basics ppt-3
 
Doctrine 2 - Introduction
Doctrine 2 - IntroductionDoctrine 2 - Introduction
Doctrine 2 - Introduction
 
Sql 2009
Sql 2009Sql 2009
Sql 2009
 
What is SQL Server?
What is SQL Server?What is SQL Server?
What is SQL Server?
 
Intro to T-SQL - 1st session
Intro to T-SQL - 1st sessionIntro to T-SQL - 1st session
Intro to T-SQL - 1st session
 
PostgreSQL Tutorial For Beginners | Edureka
PostgreSQL Tutorial For Beginners | EdurekaPostgreSQL Tutorial For Beginners | Edureka
PostgreSQL Tutorial For Beginners | Edureka
 
Types of sql commands by naveen kumar veligeti
Types of sql commands by naveen kumar veligetiTypes of sql commands by naveen kumar veligeti
Types of sql commands by naveen kumar veligeti
 
Database Systems - Introduction to SQL (Chapter 3/1)
Database Systems - Introduction to SQL (Chapter 3/1)Database Systems - Introduction to SQL (Chapter 3/1)
Database Systems - Introduction to SQL (Chapter 3/1)
 
Database Programming Techniques
Database Programming TechniquesDatabase Programming Techniques
Database Programming Techniques
 
Introduction to SQL, SQL*Plus
Introduction to SQL, SQL*PlusIntroduction to SQL, SQL*Plus
Introduction to SQL, SQL*Plus
 
Sql and Sql commands
Sql and Sql commandsSql and Sql commands
Sql and Sql commands
 
Database Programming
Database ProgrammingDatabase Programming
Database Programming
 
SQL Commands
SQL Commands SQL Commands
SQL Commands
 
SQL Overview
SQL OverviewSQL Overview
SQL Overview
 
Introduction to JDBC and database access in web applications
Introduction to JDBC and database access in web applicationsIntroduction to JDBC and database access in web applications
Introduction to JDBC and database access in web applications
 
T-SQL Overview
T-SQL OverviewT-SQL Overview
T-SQL Overview
 
Introduction to mysql part 1
Introduction to mysql part 1Introduction to mysql part 1
Introduction to mysql part 1
 
Sql a practical introduction
Sql   a practical introductionSql   a practical introduction
Sql a practical introduction
 

Viewers also liked

Sql interview question part 9
Sql interview question part 9Sql interview question part 9
Sql interview question part 9kaashiv1
 
Sql server 2008 interview questions answers
Sql server 2008 interview questions answersSql server 2008 interview questions answers
Sql server 2008 interview questions answersJitendra Gangwar
 
Sql Server Interview Question
Sql Server Interview QuestionSql Server Interview Question
Sql Server Interview Questionpukal rani
 
2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShareSlideShare
 
What to Upload to SlideShare
What to Upload to SlideShareWhat to Upload to SlideShare
What to Upload to SlideShareSlideShare
 
Getting Started With SlideShare
Getting Started With SlideShareGetting Started With SlideShare
Getting Started With SlideShareSlideShare
 

Viewers also liked (8)

Sql interview question part 9
Sql interview question part 9Sql interview question part 9
Sql interview question part 9
 
Sql server 2008 interview questions answers
Sql server 2008 interview questions answersSql server 2008 interview questions answers
Sql server 2008 interview questions answers
 
SSIS Presentation
SSIS PresentationSSIS Presentation
SSIS Presentation
 
Sql Server Interview Question
Sql Server Interview QuestionSql Server Interview Question
Sql Server Interview Question
 
SlideShare 101
SlideShare 101SlideShare 101
SlideShare 101
 
2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare
 
What to Upload to SlideShare
What to Upload to SlideShareWhat to Upload to SlideShare
What to Upload to SlideShare
 
Getting Started With SlideShare
Getting Started With SlideShareGetting Started With SlideShare
Getting Started With SlideShare
 

Similar to Sql server

Sql server-dba
Sql server-dbaSql server-dba
Sql server-dbaNaviSoft
 
Kaashiv SQL Server Interview Questions Presentation
Kaashiv SQL Server Interview Questions PresentationKaashiv SQL Server Interview Questions Presentation
Kaashiv SQL Server Interview Questions Presentationkaashiv1
 
Sql interview question part 6
Sql interview question part 6Sql interview question part 6
Sql interview question part 6kaashiv1
 
Sql interview-question-part-6
Sql interview-question-part-6Sql interview-question-part-6
Sql interview-question-part-6kaashiv1
 
Sql interview-question-part-6
Sql interview-question-part-6Sql interview-question-part-6
Sql interview-question-part-6kaashiv1
 
Lecture on DBMS & MySQL.pdf v. C. .
Lecture on DBMS & MySQL.pdf v.  C.     .Lecture on DBMS & MySQL.pdf v.  C.     .
Lecture on DBMS & MySQL.pdf v. C. .MayankSinghRawat6
 
Islamic University Previous Year Question Solution 2018 (ADBMS)
Islamic University Previous Year Question Solution 2018 (ADBMS)Islamic University Previous Year Question Solution 2018 (ADBMS)
Islamic University Previous Year Question Solution 2018 (ADBMS)Rakibul Hasan Pranto
 
Ms sql server architecture
Ms sql server architectureMs sql server architecture
Ms sql server architectureAjeet Singh
 
Dbms important questions and answers
Dbms important questions and answersDbms important questions and answers
Dbms important questions and answersLakshmiSarvani6
 
Advanced SQL - Database Access from Programming Languages
Advanced SQL - Database Access  from Programming LanguagesAdvanced SQL - Database Access  from Programming Languages
Advanced SQL - Database Access from Programming LanguagesS.Shayan Daneshvar
 
Dbms & prog lang
Dbms & prog langDbms & prog lang
Dbms & prog langTech_MX
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database DeploymentsMike Willbanks
 
Introduction to sql server
Introduction to sql serverIntroduction to sql server
Introduction to sql serverVinay Thota
 

Similar to Sql server (20)

Sql server-dba
Sql server-dbaSql server-dba
Sql server-dba
 
Kaashiv SQL Server Interview Questions Presentation
Kaashiv SQL Server Interview Questions PresentationKaashiv SQL Server Interview Questions Presentation
Kaashiv SQL Server Interview Questions Presentation
 
Module02
Module02Module02
Module02
 
Ebook6
Ebook6Ebook6
Ebook6
 
Sql interview question part 6
Sql interview question part 6Sql interview question part 6
Sql interview question part 6
 
Ebook6
Ebook6Ebook6
Ebook6
 
Sql interview-question-part-6
Sql interview-question-part-6Sql interview-question-part-6
Sql interview-question-part-6
 
Sql interview-question-part-6
Sql interview-question-part-6Sql interview-question-part-6
Sql interview-question-part-6
 
Lecture on DBMS & MySQL.pdf v. C. .
Lecture on DBMS & MySQL.pdf v.  C.     .Lecture on DBMS & MySQL.pdf v.  C.     .
Lecture on DBMS & MySQL.pdf v. C. .
 
Islamic University Previous Year Question Solution 2018 (ADBMS)
Islamic University Previous Year Question Solution 2018 (ADBMS)Islamic University Previous Year Question Solution 2018 (ADBMS)
Islamic University Previous Year Question Solution 2018 (ADBMS)
 
Ms sql server architecture
Ms sql server architectureMs sql server architecture
Ms sql server architecture
 
Dbms important questions and answers
Dbms important questions and answersDbms important questions and answers
Dbms important questions and answers
 
PT- Oracle session01
PT- Oracle session01 PT- Oracle session01
PT- Oracle session01
 
Viva voce
Viva voceViva voce
Viva voce
 
Advanced SQL - Database Access from Programming Languages
Advanced SQL - Database Access  from Programming LanguagesAdvanced SQL - Database Access  from Programming Languages
Advanced SQL - Database Access from Programming Languages
 
Dbms & prog lang
Dbms & prog langDbms & prog lang
Dbms & prog lang
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database Deployments
 
Introduction to sql server
Introduction to sql serverIntroduction to sql server
Introduction to sql server
 
Database testing
Database testingDatabase testing
Database testing
 
Introduction to Database SQL & PL/SQL
Introduction to Database SQL & PL/SQLIntroduction to Database SQL & PL/SQL
Introduction to Database SQL & PL/SQL
 

Recently uploaded

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 

Recently uploaded (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 

Sql server

  • 1. SQL Server interview questions Explain the use of keyword WITH ENCRYPTION. Create a Store Procedure with Encryption. It is a way to convert the original text of the stored procedure into encrypted form. The stored procedure gets obfuscated and the output of this is not visible to CREATE PROCEDURE Abc WITH ENCRYPTION AS << SELECT statement>> GO What is a linked server in SQL Server? It enables SQL server to address diverse data sources like OLE DB similarly. It allows Remote server access and has the ability to issue distributed queries, updates, commands and transactions. Features and concepts of Analysis Services Analysis Services is a middle tier server for analytical processing, OLAP, and Data mining. It manages multidimensional cubes of data and provides access to heaps of
  • 2. information including aggregation of data One can create data mining models from data sources and use it for Business Intelligence also including reporting features. Some of the key features are: • Ease of use with a lot of wizards and designers. • Flexible data model creation and management • Scalable architecture to handle OLAP • Provides integration of administration tools, data sources, security, caching, and reporting etc. • Provides extensive support for custom applications What is Analysis service repository? Every Analysis server has a repository to store metadata for the objects like cubes, data sources etc. It’s by default stored in a MS Access database which can be also migrated to a SQL Server database. What is SQL service broker? Service Broker allows internal and external processes to send and receive guaranteed, asynchronous messaging. Messages can also be sent to remote servers hosting databases as well. The concept of queues is used by the broker to put a message in a queue and continue with other applications asynchronously. This enables client applications to process messages at their leisure without blocking the broker. Service Broker uses the concepts of message ordering, coordination,
  • 3. multithreading and receiver management to solve some major message queuing problems. It allows for loosely coupled services, for database applications. What is user defined datatypes and when you should go for them? User defined data types are based on system data types. They should be used when multiple tables need to store the same type of data in a column and you need to ensure that all these columns are exactly the same including length, and nullability. Parameters for user defined datatype: Name System data type on which user defined data type is based upon. Nullability. For example, a user-defined data type called post_code could be created based on char system data type. What is bit datatype? A bit datatype is an integer data type which can store either a 0 or 1 or null value. Describe the XML support SQL server extends. SQL Server (server-side) supports 3 major elements: a. Creation of XML fragments: This is done from the relational data using FOR XML to the select query.
  • 4. b. Ability to shred xml data to be stored in the database. c. Finally, storing the xml data. Client-side XML support in SQL Server is in the form of SQLXML. It can be described in terms of • XML Views: providing bidirectional mapping between XML schemas and relational tables. • Creation of XML Templates: allows creation of dynamic sections in XML. What is SQL Server English Query? English query allows accessing the relational databases through English Query applications. Such applications permit the users to ask the database to fetch data based on simple English instead of using SQL statements. What is the purpose of SQL Profiler in SQL server? SQL profiler is a tool to monitor performance of various stored procedures. It is used to debug the queries and procedures. Based on performance, it identifies the slow executing queries. Capture any problems by capturing the events on production environment so that they can be solved.
  • 5. What is XPath? XPath is an expressions to select a xml node in an XML document. It allows the navigation on the XML document to the straight to the element where we need to reach and access the attributes. What are the Authentication Modes in SQL Server? a. Windows Authentication Mode (Windows Authentication): uses user’s Windows account b. Mixed Mode (Windows Authentication and SQL Server Authentication): uses either windows or SQL server Explain Data Definition Language, Data Control Language and Data Manipulation Language. Data Definition Language (DDL):- are the SQL statements that define the database structure. Example: a. CREATE b. ALTER c. DROP d. TRUNCATE e. COMMENT f. RENAME
  • 6. Data Manipulation Language (DML):- statements are used for manipulate or edit data. Example: a. SELECT - retrieve data from the a database b. INSERT - insert data into a table c. UPDATE - updates existing data within a table d. DELETE e. MERGE f. CALL g. EXPLAIN PLAN h. LOCK TABLE Data Control Language (DCL):-statements to take care of the security and authorization. Examples: a. GRANT b. REVOKE What are the steps to process a single SELECT statement? Steps a. The select statement is broken into logical units b. A sequence tree is built based on the keywords and expressions in the form of the logical units.
  • 7. c. Query optimizer checks for various permutations and combinations to figure out the fastest way using minimum resources to access the source tables. The best found way is called as an execution plan. d. Relational engine executes the plan and processes the data Explain GO Command. Go command is a signal to execute the entire batch of SQL statements after previous Go. What is the significance of NULL value and why should we avoid permitting null values? NULL value means that no entry has been made into the column. It states that the corresponding value is either unknown or undefined. It is different from zero or "". They should be avoided to avoid the complexity in select & update queries and also because columns which have constraints like primary or foreign key constraints cannot contain a NULL value. What is the difference between UNION and UNION ALL? UNION selects only distinct values whereas UNION ALL selects all values and not just distinct ones. UNION: SELECT column_names FROM table_name1 UNION SELECT column_names FROM table_name2
  • 8. UNION All: SELECT column_names FROM table_name1 UNION ALL SELECT column_names FROM table_name2 What is use of DBCC Commands? DBCC (Database consistency checker) act as Database console commands for SQL Server to check database consistency. They are grouped as: Maintenance: Maintenance tasks on Db, filegroup, index etc. Commands include DBCC CLEANTABLE, DBCC INDEXDEFRAG, DBCC DBREINDEX, DBCC SHRINKDATABASE, DBCC DROPCLEANBUFFERS, DBCC SHRINKFILE, DBCC FREEPROCCACHE, and DBCC UPDATEUSAGE. Miscellaneous: Tasks such as enabling tracing, removing dll from memory. Commands include DBCC dllname, DBCC HELP, DBCC FREESESSIONCACHE, DBCC TRACEOFF, DBCC FREESYSTEMCACHE, and DBCC TRACEON. Informational: Tasks which gather and display various types of information. Commands include DBCC INPUTBUFFER, DBCC SHOWCONTIG, DBCC OPENTRAN, DBCC SQLPERF, DBCC OUTPUTBUFFER, DBCC TRACESTATUS, DBCC PROCCACHE, DBCC USEROPTIONS, and DBCC SHOW_STATISTICS. Validation: Operations for validating on Db, index, table etc. Commands include DBCC CHECKALLOC, DBCC CHECKFILEGROUP, DBCC CHECKCATALOG, DBCC CHECKIDENT, DBCC CHECKCONSTRAINTS, DBCC CHECKTABLE, and DBCC CHECKDB.
  • 9. What is Log Shipping? Log shipping defines the process for automatically taking backup of the database and transaction files on a SQL Server and then restoring them on a standby/backup server. This keeps the two SQL Server instances in sync with each other. In case production server fails, users simply need to be pointed to the standby/backup server. Log shipping primarily consists of 3 operations: Backup transaction logs of the Production server. Copy these logs on the standby/backup server. Restore the log on standby/backup server. What is the difference between a Local and a Global temporary table? Temporary tables are used to allow short term use of data in SQL Server. They are of 2 types: Local Global Only available to the current Db Available to any connection once connection for current user and are created. They are cleared when the last cleared when connection is closed. connection is closed. Multiple users can’t share a local Can be shared by multiple user sessions. temporary table. What is the STUFF and how does it differ from the REPLACE function?
  • 10. Both STUFF and REPLACE are used to replace characters in a string. select replace('abcdef','ab','xx') results in xxcdef select replace('defdefdef','def','abc') results in abcabcabc We cannot replace a specific occurrence of “def” using REPLACE. select stuff('defdefdef',4, 3,'abc') results in defabcdef where 4 is the character to begin replace from and 3 is the number of characters to replace. What are the rules to use the ROWGUIDCOL property to define a globally unique identifier column? Only one column can exist per table that is attached with ROWGUIDCOL property. One can then use $ROWGUID instead of column name in select list. What is the actions prevented once referential integrity is enforced? Actions prevented are: • Breaking of relationships is prevented once referential integrity on a database is enforced. • Can’t delete a row from primary table if there are related rows in secondary table.
  • 11. • Can’t update primary table’s primary key if row being modified has related rows in secondary table. • Can’t insert a new row in secondary table if there are not related rows in primary table. • Can’t update secondary table’s foreign key if there is no related row in primary table. What are the commands available for Summarizing Data in SQL Server? Commands for summarizing data in SQL Server: Command Description Syntax/Example SUM Sums related values SELECT SUM(Sal) as Tot from Table1; AVG Average value SELECT AVG(Sal) as Avg_Sal from Table1; COUNT Returns number of rows SELECT COUNT(*) of resultset from Table1; MAX Returns max value from a SELECT MAX(Sal) from resultset Table1; MIN Returns min value from a SELECT MIN(Sal) from resultset Table1; GROUP BY Arrange resultset in SELECT ZIP,City FROM groups Emp GROUP BY ZIP ORDER BY Sort resultset SELECT ZIP,City FROM Emp ORDER BY City List out the difference between CUBE operator and ROLLUP operator
  • 12. Difference between CUBE and ROLLUP: CUBE ROLLUP It’s an additional switch to GROUP BY It’s an extension to GROUP BY clause. clause. It can be applied to all It’s used to extract statistical and aggregation functions to return cross summarized information from result tabular result sets. . sets. It creates groupings and then applies aggregation functions on them. Produces all possible combinations of Produces only some possible subtotal subtotals specified in GROUP BY combinations. clause and a Grand Total. What are the guidelines to use bulk copy utility of SQL Server? Bulk copy is an API that allows interacting with SQL Server to export/import data in one of the two data formats. Bulk copy needs sufficient system credentials. • Need INSERT permissions on destination table while importing. • Need SELECT permissions on source table while exporting. • Need SELECT permissions on sysindexes, sysobjects and syscolumns tables. bcp.exe northwind..cust out "c:cust.txt" –c -T Export all rows in Northwind.Cust table to an ASCII-character formatted text file. What are the capabilities of Cursors?
  • 13. Capabilities of cursors: • Cursor reads every row one by one. • Cursors can be used to update a set of rows or a single specific row in a resultset • Cursors can be positioned to specific rows. • Cursors can be parameterized and hence are flexible. • Cursors lock row(s) while updating them. What are the ways to controlling Cursor Behavior? There are 2 ways to control Cursor behavior: • Cursor Types: Data access behavior depends on the type of cursor; forward only, static, keyset-drive and dynamic. • Cursor behaviors: Keywords such as SCROLL and INSENSITIVE along with the Cursor declaration define scrollability and sensitivity of the cursor. What are the advantages of using Stored Procedures? Advantages of using stored procedures are: • They are easier to maintain and troubleshoot as they are modular. • Stored procedures enable better tuning for performance. • Using stored procedures is much easier from a GUI end than building/using complex queries.
  • 14. • They can be part of a separate layer which allows separating the concerns. Hence Database layer can be handled by separate developers proficient in database queries. • Help in reducing network usage. • Provides more scalability to an application. • Reusable and hence reduce code. What are the ways to code efficient transactions? Some ways and guidelines to code efficient transactions: • Do not ask for an input from a user during a transaction. • Get all input needed for a transaction before starting the transaction. • Transaction should be atomic • Transactions should be as short and small as possible. • Rollback a transaction if a user intervenes and re-starts the transaction. • Transaction should involve a small amount of data as it needs to lock the number of rows involved. • Avoid transactions while browsing through data. What are the differences among batches, stored procedures, and triggers? Batch Stored Procedure Triggers Collection or group of It’s a collection or group It’s a type of Stored SQL statements. All of SQL statements that’s procedure that cannot be
  • 15. statements of a batch are compiled once but used called directly. Instead it compiled into one many times. fires when a row is executional unit called updated, deleted, or execution plan. All inserted. statements are then executed statement by statement. What security features are available for stored procedures? Security features for stored procedures: • Grants users permissions to execute a stored procedure irrespective of the related tables. • Grant users users permission to work with a stored procedure to access a restricted set of data yet no give them permissions to update or select underlying data. • Stored procedures can be granted execute permissions rather than setting permissions on data itself. • Provide more granular security control through stored procedures rather than complete control on underlying data in tables. What are the instances when triggers are appropriate? Scenarios for using triggers: • To create a audit log of database activity. • To apply business rules. • To apply some calculation on data from tables which is not stored in them.
  • 16. • To enforce referential integrity. • Alter data in a third party application • To execute SQL statements as a result of an event/condition automatically. What are the restrictions applicable while creating views? Restrictions applicable while creating views: • A view cannot be indexed. • A view cannot be Altered or renamed. Its columns cannot be renamed. • To alter a view, it must be dropped and re-created. • ANSI_NULLS and QUOTED_IDENTIFIER options should be turned on to create a view. • All tables referenced in a view must be part of the same database. • Any user defined functions referenced in a view must be created with SCHEMABINDING option. • Cannot use ROWSET, UNION, TOP, ORDER BY, DISTINCT, COUNT(*), COMPUTE, COMPUTE BY in views. What are the events recorded in a transaction log? Events recorded in a transaction log: • Broker event category includes events produced by Service Broker. • Cursors event category includes cursor operations events. • CLR event category includes events fired by .Net CLR objects.
  • 17. • Database event category includes events of data.log files shrinking or growing on their own. • Errors and Warning event category includes SQL Server warnings and errors. • Full text event category include events occurred when text searches are started, interrupted, or stopped. • Locks event category includes events caused when a lock is acquired, released, or cancelled. • Object event category includes events of database objects being created, updated or deleted. • OLEDB event category includes events caused by OLEDB calls. • Performance event category includes events caused by DML operators. • Progress report event category includes Online index operation events. • Scans event category includes events notifying table/index scanning. • Security audit event category includes audit server activities. • Server event category includes server events. • Sessions event category includes connecting and disconnecting events of clients to SQL Server. • Stored procedures event category includes events of execution of Stored procedures. • Transactions event category includes events related to transactions. • TSQL event category includes events generated while executing TSQL statements. • User configurable event category includes user defined events.
  • 18. Describe when checkpoints are created in a transaction log. Activities causing checkpoints are: • When a checkpoint is explicitly executed. • A logged operation is performed on the database. • Database files have been altered using Alter Database command. • SQL Server has been stopped explicitly or on its own. • SQL Server periodically generates checkpoints. • Backup of a database is taken. Define Truncate and Delete commands. TRUNCATE DELETE This is also a logged operation but in This is a logged operation for every row. terms of deallocation of data pages. Cannot TRUNCATE a table that has Any row not violating a constraint can foreign key constraints. be Deleted. Resets identity column to the default Does not reset the identity column. starting value. Starts where it left from last. Removes all rows from a table. Used delete all or selected rows from a table based on WHERE clause. Cannot be Rolled back. Need to Commit or Rollback DDL command DML command
  • 19. For more questions with answers, follow the link below: http://www.careerride.com/SQLServer-Interview-Questions.aspx We do not warrant the correctness of content. The risk from using it lies entirely with the user. While using this document, you agree to have read and accepted the terms of use and privacy policy.