热门面试题与答案和在线测试
面向面试准备、在线测试、教程与实战练习的学习平台

通过聚焦学习路径、模拟测试和面试实战内容持续提升技能。

WithoutBook 将分主题面试题、在线练习测试、教程和对比指南整合到一个响应式学习空间中。

面试准备

MSSQL 面试题与答案

问题 1. What is the simplest way to create a new database in MS SQL Server?

The simplest way to create a new database is to use the "CREATE DATABASE" statement with this syntax:

CREATE DATABASE database_name

For example, run this statement:

CREATE DATABASE YourDataBaseName
GO

A new database called "YourDataBaseName" should be created in the SQL server. Of course, YourDataBaseName database should be empty at this moment - no tables. But it should have some other data objects automatically created by the server.

这有帮助吗? 添加评论 查看评论
 

问题 2. How to set the current database in MS SQL Server?

Once you are connected to the SQL Server, you should select a database to work with and set it as the current database using the "USE" statement with this syntax:

USE database_name

The following tutorial example shows you how to set "YourDataBaseName" as the current database, and create a table in "YourDataBaseName":

USE YourDataBaseName
GO
Changed database context to 'YourDataBaseName'.

CREATE TABLE Links (Name NVARCHAR(32))
GO

SELECT name, type_desc, create_date FROM sys.tables
GO
name type_desc create_date
Links USER_TABLE 2007-05-19 23:05:43.700

这有帮助吗? 添加评论 查看评论
 

问题 3. How to delete a database in MS SQL Server?

If you created a database incorrectly, or you have a database that is not needed any more, you can delete it with the "DROP DATABASE" statement with this syntax:

DROP DATABASE database_name

For example, execute this statement:

DROP DATABASE YourDataBaseName
GO

The database "YourDataBaseName" created in the previous tutorial should be deleted from the SQL server.

Warning, if you delete a database, all tables and their data in that database will be deleted.

这有帮助吗? 添加评论 查看评论
 

问题 4. Why I am getting this error when dropping a database in MS SQL Server?

If you are trying to drop a database that is in use, you will get an error message like this: 'Cannot drop database "withoutbook" because it is currently in use.'

Before dropping a database, you must stop all client sessions using this database. If your own client session is using this database, you should set a different database as the current database as shown in this tutorial example:

CREATE DATABASE withoutbook
GO

USE withoutbook
GO

DROP DATABASE withoutbook
GO
Msg 3702, Level 16, State 4, Server LOCALHOSTSQLEXPRESS
Cannot drop database "withoutbook" because it is
currently in use.

USE master
GO

DROP DATABASE withoutbook
GO

这有帮助吗? 添加评论 查看评论
 

问题 5. What is Microsoft SQL Server?

Microsoft SQL Server is a relational database management system (RDBMS) developed by Microsoft. It runs on Windows systems and uses Transact-SQL as the query language.

Microsoft SQL Server release history:

* 1993 - SQL Server 4.21 for Windows NT
* 1995 - SQL Server 6.0, codenamed SQL95
* 1996 - SQL Server 6.5, codenamed Hydra
* 1999 - SQL Server 7.0, codenamed Sphinx
* 1999 - SQL Server 7.0 OLAP, codenamed Plato
* 2000 - SQL Server 2000 32-bit, codenamed Shiloh (version 8.0)
* 2003 - SQL Server 2000 64-bit, codenamed Liberty
* 2005 - SQL Server 2005, codenamed Yukon (version 9.0)
* 2005 - SQL Server 2005 Express Edition, restricted free version

这有帮助吗? 添加评论 查看评论
 

用户评价最有帮助的内容:

版权所有 © 2026,WithoutBook。