MCSA 70-761 SQL Server 2016 练习题搬运

时间:2022-01-08 03:29:51

原网站链接:http://www.accelerated-ideas.com/aiMExamsChoose.aspx#mcse

为了方便下次看的时候一眼就理解,顺手加上了粗略翻译。

1. Your team is developing a database for a new online travel application. You need to design tables and other database objects to support the application. One particular table called Airline_Schedules needs to store the departure and arrival dates and times of flights along with time zone information.

What should you do?

你的团队正在开发一个旅游应用的数据库,你需要设计一些数据库和表之类的东西。其中有个特殊的表叫Airline_Schedules,需要往里面保存飞机出发和到达的日期 时间 时区信息,你咋办?

A. Use the CAST function
B.Use a user-defined table type
C.Use the DATETIME2 data type
D.Use the DATETIMEOFFSET data type

答:这里选D,因为DATETIMEOFFSET数据格式可以保存时区信息。

 

2. You‘ve been told to execute the following SQL command to create a new table called employees. The id column of the new table will be an auto increment column but what do the 2 numbers after the IDENTITY clause mean?
你被要求运行下面的sql命令来创建一个雇员表,id列自动递增,那么代码中IDENTITY后面括号中的两个数字分别代表什么?
CREATE TABLE new_employees ( id_num int IDENTITY(100,10), fname varchar (20), minit char(1), lname varchar(30) )

A.seed, increment
B.increment, seed
C.max value, seed
D.max value, increment

答:A,初始值,递增量。

 

3. Can you combine rowstore and columnstore on the same table?

在同一个表中,行存储和列存储可以结合使用吗?

A.Yes

B.NO

答:A,Beginning with SQL Server 2016, you can create an updatable nonclustered columnstore index on a rowstore table. The columnstore index stores a copy of the chosen columns so you do need extra space for this but it will be compressed on average by 10x. By doing this, you can run analytics on the columnstore index and transactions on the rowstore index at the same time. The column store is updated when data changes in the rowstore table, so both indexes are working against the same data.

从SQL Server 2016开始,您可以在rowstore表上创建一个可更新的非聚集的columnstore索引。columnstore索引存储所选列的一个副本,因此确实需要额外的空间,但它平均会被压缩10倍。通过这样做,您可以同时对columnstore索引和rowstore索引上的事务运行分析。当rowstore表中的数据发生更改时,列存储将被更新,因此两个索引将针对相同的数据工作。

 

4. As part of a new HR project you‘re creating several stored procedures that will add logging information to the logs table. This logging information is very detailed and should contain carriage returns to make paragraphs more readable. How can you add carriage returns to text when inserting into a table?

在一个HR项目中你需要新建一些存储过程来向日志表中添加日志信息,这个日志很详细,因此你需要插入一些回车符来增加可读性,如何在向表插入时将回车添加到文本?

A.Use CHAR
B.Use CASE
C.Use COS
D.Use TEXTPTR

答:A,You can use CHAR(13) to add carriage returns. The CHAR function converts an int ASCII code to a character. 

您可以使用CHAR(13)来添加回车。CHAR函数将int ASCII码转换为字符。

 

5. You can use the PIVOT and UNPIVOT relational operators to change a table-valued expression into another table. Which clause rotates a table-valued expression by turning the unique values from one column in the expression into multiple columns in the output, and performs aggregations where they are required on any remaining column values that are wanted in the final output?

你可以使用 PIVOT 和 UNPIVOT 关系运算符将表值表达式更改为另一个表。哪个可以将表达式某一列中的唯一值转换为输出中的多个列来旋转表值表达式,并在必要时对最终输出中所需的任何其余列值执行聚合?

A.PIVOT
B.UNPIVOT

答:A,感觉这个题难度主要在于读懂英文题意,选答案倒是不难。。。解释:可以使用 PIVOT 和 UNPIVOT 关系运算符将表值表达式更改为另一个表。PIVOT 通过将表达式某一列中的唯一值转换为输出中的多个列来旋转表值表达式,并在必要时对最终输出中所需的任何其余列值执行聚合。UNPIVOT 与 PIVOT 执行相反的操作,将表值表达式的列转换为列值。

 

6. A DML trigger is an action programmed to execute when a data manipulation language (DML) event occurs in the database server. DML events include UPDATE, INSERT, or DELETE statements issued against a table or view. Which of the following is TRUE regarding INSTEAD OF triggers?

A.INSTEAD OF triggers fire in place of the triggering action and before constraints are processed
B.If the constraints are violated, the AFTER trigger is not executed.
C.If there are AFTER triggers on the table, they will fire after constraint processing.
D.All of these

答:D。

 

7.As part of a global e-commerce business you are developing a Microsoft SQL Server database that supports the company‘s online website. The application contains a table that has the following definition:


CREATE TABLE Inventory
(ItemID int NOT NULL PRIMARY KEY,
ProductsInStore int NOT NULL,
ProductsInWarehouse int NOT NULL)

You need to create a computed column that returns the sum total of the ProductsInStore and ProductsInWarehouse values for each row. Which T-SQL statement should you use?

A.ALTER TABLE Inventory
ADD ProductsInStore - ProductsInWarehouse = TotalProducts
B.ALTER TABLE Inventory
ADD TotalProducts AS ProductsInStore ProductsInWarehouse
C.ALTER TABLE Inventory
ADD TotalProducts AS SUM(ProductsInStore, ProductslnWarehouse);
D.ALTER TABLE Inventory
ADD TotalProducts = ProductsInStore ProductsInWarehouse

答:B.