Top 50 Sql Server 2005 Interview Questions You Must Prepare 27.Jul.2024

Q1. Are Semicolons Required At The End Of Sql Statements In Sql Server 2005?

No it is not required.

Q2. 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 databases using T-SQL Statements.

Q3. Does Server Sql Treat Char As A Variable-length Or Fixed-length Column?

SQL Server treats CHAR as fixed length column.

Q4. Will Count(column) Include Columns With Null Values In Its Count?

Yes, it will include the null column in count.

Q5. What Is A Foreign Key?

FOREIGN KEY constraints identify the relationships between tables.
A foreign key in one table points to a candidate key in another table. Foreign keys prevent actions that would leave rows with foreign key values when there are no candidate keys with that value. In the following sample, the order_part table establishes a foreign key referencing the part_sample table defined earlier. Usually, order_part would also have a foreign key against an order table, but this is a simple example.
CREATE TABLE order_part
(order_nmbr int,
part_nmbr int
FOREIGN KEY REFERENCES part_sample(part_nmbr)
ON DELETE NO ACTION,
qty_ordered int)
GO.

Q6. Will Sql Server 2005 Allow You To Reduce The Size Of A Column?

Yes it allows.

Q7. What Is The Syntax To Execute The Sys.dm_db_missing_index_details?

Select * from sys.dm_db_missing_index_details.

Q8. What Are Four Major Operators That Can Be Used To Combine Conditions On A Where Clause?

OR, AND, IN and BETWEEN.

Q9. What Is A Query?

A request for information from a database. There are three general methods for posing queries:

  • Choosing parameters from a menu: In this method, the database system presents a list of parameters from which you can choose. This is perhaps the easiest way to pose a query because the menus guide you, but it is also the least flexible.
  • Query by example (QBE): In this method, the system presents a blank record and lets you specify the fields and values that define the query.
  • Query language: Many database systems require you to make requests for information in the form of a stylized query that must be written in a special query language. This is the most complex method because it forces you to learn a specialized language, but it is also the most powerful.

Q10. What Does The Not Null Constraint Do?

Constrain will not allow NULL values in the column.

Q11. Can We Perform Backup Restore Operation On Tempdb?

NO.

Q12. What Does The On Update No Action Do?

ON UPDATE NO ACTION:

  • Specifies that if an attempt is made to update a key value in a row whose key is referenced by foreign keys in existing rows in other tables, an error is raised and the UPDATE is rolled back.
  • Specifies that if an attempt is made to delete a row with a key referenced by foreign keys in existing rows in other tables, an error is raised and the DELETE is rolled back.

Q13. What Is The Default Port No On Which Sql Server Listens?

1433.

Q14. What Is The Parse Query Button Used For?

Parse query button is used to check the SQL Query Syntax.

Q15. What Is The Purpose Of The Master Database?

Master database keeps the information about sql server configuration, databases users etc.

Q16. What Is The Purpose Of The Tempdb Database?

Tempdb database keeps the information about the temporary objects (#TableName, #Procedure). Also the sorting, DBCC operations are performed in the TempDB.

Q17. Do Comments Need To Go In A Special Place In Sql Server 2005?

No its not necessary.

Q18. What Is The Default Value Of An Integer Data Type In Sql Server 2005?

NULL.

Q19. What Is The Purpose Of The Model Database?

It works as Template Database for the Create Database Syntax.

Q20. What Stored By The Master?

Server's configurations and logins.

Q21. How Do You Troubleshoot Errors In A Sql Server Agent Job?

Inside SSMS, in Object explorer under SQL Server Agent look for Job Activity Monitor. The job activity monitor displays the current status of all the jobs on the instance. Choose the particular job which failed, right click and choose view history from the drop down menu. The execution history of the job is displayed and you may choose the execution time (if the job failed multiple times during the same day). There would information such as the time it took to execute that Job and details about the error occurred.

Q22. What Are The Commands Used In Dcl?

GRANT, DENY and REVOKE.

Q23. What Is Fill Factor?

Fill Factor is a setting that is applicable to Indexes in SQL Server. The fill factor value determines how much data is written to an index page when it is created / rebuilt.

Q24. When Would You Use An Insert Into .. Select Option Versus An Insert Into .. Values Option? Give An Example Of Each?

INSERT INTO .. SELECT is used insert data in to table from different tables or condition based insert.
INSERT INTO .. VALUES you have to specify the insert values.

Q25. Is A Null Value Equal To Anything? Can A Space In A Column Be Considered A Null Value? Why Or Why Not?

No NULL value means nothing. We can’t consider space as NULL value.

Q26. Does A Sql Server 2005 Select Statement Require A From?

NO.

Q27. What Does The On Delete Cascade Option Do?

ON DELETE CASCADE:

  • Specifies that if an attempt is made to delete a row with a key referenced by foreign keys in existing rows in other tables, all rows containing those foreign keys are also deleted. If cascading referential actions have also been defined on the target tables, the specified cascading actions are also taken for the rows deleted from those tables.
  • Specifies that if an attempt is made to update a key value in a row, where the key value is referenced by foreign keys in existing rows in other tables, all of the foreign key values are also updated to the new value specified for the key. If cascading referential actions have also been defined on the target tables, the specified cascading actions are also taken for the key values updated in those tables.

Q28. What Are The Dmvs?

Dynamic Management Views (DMV) return server state information that can be used to monitor the health of a server instance, diagnose problems, and tune performance.

Q29. What Command Would You Use To Add A Column To A Table In Sql Server?

ALTER TABLE tablename ADD column_name DATATYPE.

Q30. What Are System Databases Into Sql Server (2005/2008)?

TEMPDB, MSDEB, MASTER, MSDB, mssqlsystemresource.

Q31. What Is The Default Order Of An Order By Clause?

Ascending Order.

Q32. Where The Sql Logs Gets Stored?

It's stored into root folder SQL server, LOG folder.

Q33. How Are The Unique And Primary Key Constraints Different?

A UNIQUE constraint is similar to PRIMARY key, but you can have more than one UNIQUE constraint per table. When you declare a UNIQUE constraint, SQL Server creates a UNIQUE index to speed up the process of searching for duplicates. In this case the index defaults to NONCLUSTERED index, because you can have only one CLUSTERED index per table.

  •  The number of UNIQUE constraints per table is limited by the number of indexes on the table i.e 249 NONCLUSTERED index and one possible CLUSTERED index.
  • Contrary to PRIMARY key UNIQUE constraints can accept NULL but just once. If the constraint is defined in a combination of fields, then every field can accept NULL and can have some values on them, as long as the combination values is unique.

Q34. Does Order By Actually Change The Order Of The Data In The Tables Or Does It Just Change The Output?

Order By clause change only the output of the data.

Q35. Can You Change The Data Type Of A Column In A Table After The Table Has Been Created? If So, Which Command Would You Use?

Yes we can. Alter Table Modify Column.

Q36. What Is Usually The First Word In A Sql Query?

SELECT.

Q37. While You Are Inserting Values Into A Table With The Insert Into .. Values Option, Does The Order Of The Columns In The Insert Statement Have To Be The Same As The Order Of The Columns In The Table?

Not Necessary.

Q38. When Columns Are Added To Existing Tables, What Do They Initially Contain?

The column initially contains the NULL values.

Q39. What Does The Update Command Do?

Update command will modify the existing record.

Q40. What Is The New In Sql Server 2008?

File stream data type, Activity Monitor, Resource governor, data compression, compressed backup.

Q41. What Is The Order By Used For?

Order By clause is used for sorting records in Ascending or Descending order.

Q42. What Stored By The Model?

Templates of new database objects, like tables and column.

Q43. How Many Files Can A Database Contain In Sql Server?how Many Types Of Data Files Exists In Sql Server? How Many Of Those Files Can Exist For A Single Database?

  •  A Database can contain a maximum of 32,767 files.
  •  There are Primarily 2 types of data files Primary data file and Secondary data file(s). There can be only one Primary data file and multiple secondary data files as long as the total # of files is less than 32,767 files.

Q44. Can You Type More Than One Query In The Query Editor Screen At The Same Time?

Yes we can.

Q45. What Stored By The Msdb?

Scheduled jobs, Backup/Restore and DTA information.

Q46. What Command Must You Use To Include The Not Null Constraint After A Table Has Already Been Created?

DEFAULT, WITH CHECK or WITH NOCHECK.

Q47. Does An Index Slow Down Updates On Indexed Columns?

Yes.

Q48. Can A Synonym Name Of A Table Be Used Instead Of A Table Name In A Select Statement?

Yes.

Q49. When A Primary Key Constraint Is Included In A Table, What Other Constraints Does This Imply?

Unique + NOT NULL.

Q50. What Command Would You Use To Create An Index?

CREAT INDEX INDEXNAME ON TABLE(COLUMN NAME).