Interviewer And Interviewee Guide

Behavioral SQL Server Architecture Interview Questions & Answers:

1. What do you know about system database?

The system database contains information/metadata for all database present on an SQL Server instance. The system database stores information regarding logins, configuration settings, connected servers etc. It also holds various extended stored procedures to access external processes and applications.

Major system databases :

Master: Core system database to mange Sql Server instance.
Resource: Responsible for physically storing all system objects.
TempDB: This is a temporary database used to store temporary, tables, cursors, indexes, variables etc.
Model: This acts as a template database for all user created databases.
MSDB: Database to manage SQL Server agent configurations.
Distribution: Database primarily used for SQL Server replication.
ReportServer: Main database for reporting services to store metadata and other object definitions.
ReportServerTempDB: Acts as a temporary storage for reporting services.

2. Please explain that what are the basic functions for master, msdb, model, tempdb and resource databases?

Master database is used to store information of all the databases on the SQL server. The server cannot start if the database is not configured properly.

The msdb database stores information regarding database backups, SQL Agent information, DTS packages, SQL Server jobs, and some replication information such as for log shipping.

The tempdb is used to store temporary objects such as global and local temporary tables and stored procedures.

The model is essentially a template database used in the creation of any new user database created in the instance.

The resoure Database is a read-only database that contains all the system objects that are included with SQL Server. SQL Server system objects, such as sys.objects, are physically persisted in the Resource database, but they logically appear in the sys schema of every database. The Resource database does not contain user data or user metadata.

3. What is Model Database?

It is a template database used in the creation of new database.

4. What is TEMPDB Database?

It stores temporary objects like temporary tables and temporary stored procedure.

5. What is MSDB Database?

It stores information related to database backups, DTS packages, Replication, SQL Agent information, SQL Server jobs.

6. What is Master Database?

Master database is system database. It contains information about server's configuration. It is a very important database and important to backup Master database. Without Master database, server can't be started.

7. Explain the Microsoft SQL Server delete command?

Delete command removes records one at a time and logs into the transaction log.
It can be used with or without where clause.
The records can be rolled back.
It activates trigger.
It doesn't reset the identity of the column.

8. Explain the truncate command?

Truncate command is used to remove all rows of the column.
The removed records are not recorded in the transaction log.
It is the fast way to remove all the records from the table.
The records once removed can't be rolled back.
It can't activate trigger.
It resets the identity of the column.

9. Can you explain 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.

10. Explain what are the restrictions that views have to follow?

Since a view is a virtual table - columns of the view cannot be renamed. To change anything in the view, the view must be dropped and create again.
The select statement on the view cannot contain ORDER BY or INTO TEMP
When a table or view is dropped, any views in the same database are also dropped.
It is not possible to create an index on a view
It is not possible to use DELETE to update a view that is defined as a join.

Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.