NIIT認證

當前位置 /首頁/IT認證/NIIT認證/列表

NIITsql選擇題考試題庫

NIIT的工作領域包括系統合成,商業對策,工程,製造,財務,網路工程,通訊,資訊科技諮詢,應用軟體開發,多媒體軟體及職業資訊科技培訓和企業資訊科技培訓。以下是關於NIITsql選擇題考試題庫,希望大家認真閱讀!

NIITsql選擇題考試題庫

  選擇題:(每空2分共20分)

1、在MS SQL Server中,用來顯示資料庫資訊的系統儲存過程是( )

A sp_ dbhelp

B sp_ db

C sp_ help

D sp_ helpdb

2、SQL語言中,刪除一個表的命令是( )

A DELETE

B DROP

C CLEAR

D REMORE

3、關係資料庫中,主鍵是(__)

A、為標識表中唯一的實體

B、建立唯一的索引,允許空值

C、只允許以表中第一欄位建立

D、允許有多個主鍵的

4、在Transact-SQL語法中,SELECT語句的完整語法較複雜,但至少包括的部分(1___),使用關鍵字(2___)可以把重複行遮蔽,將多個查詢結果返回一個結果集合的運算子是(3___),如果在SELECT語句中使用聚合函式時,一定在後面使用(4___)。

⑴ A、SELECT,INTO B、SELECT,FROM

C、SELECT,GROUP D、僅SELECT

⑵ A、DISTINCT B、UNION

C、ALL C、TOP

⑶ A、JOIN B、UNION

C、INTO C、LIKE

⑷ A、GROUP BY B、COMPUTE BY

C、HAVING D、COMPUTE

5、語句DBCC SHRINKDATABASE (Sample, 25)中的25表示的意思是

A、25M

B、剩餘佔整個空間的25%

C、已用空間佔整個空間的25%

D、以上都不對

6、你是一個保險公司的`資料庫開發人員,公司的保單資訊儲存在SQL Server 2000資料庫中,你使用以下指令碼建立了一個名為Policy的表:

CREATE TABLE Policy

(

PolicyNumber int NOT NULL DEFAULT (0),

InsuredLastName char (30) NOT NULL,

InsuredFirstName char (20) NOT NULL,

InsuredBirthDate datetime NOT NULL,

PolicyDate datetime NOT NULL,

FaceAmount money NOT NULL,

CONSTRAINT PK_Policy PRIMARY KEY (PolicyNumber)

)

每次公司銷售出一份保單,Policy表中就增加一條記錄,並賦予其一個新的保單號,你將怎麼做?

a.建立一個INSTEAD OF INSERT觸發器來產生一個新的保單號,並將這個保單號插入資料表中。

b.建立一個INSTEAD OF UPDATE觸發器來產生一個新的保單號,並將這個保單號插入資料表中。

c.建立一個AFTER UPDATE觸發器來產生一個新的保單號,並將這個保單號插入資料表中。

d.用AFTER UPDATE觸發器替代DEFAULT約束條件產生一個新的保單號,並將這個保單號插入資料表中。

7、在SQL語言中,如果要建立一個工資表包含職工號,姓名,職稱。工資等欄位。若要保證工資欄位的取值不低於800元,最合適的實現方法是:

A。在建立工資表時為”工資“欄位建立預設

B。在建立工資表時為”工資“欄位建立檢查約束

C。在工資表建立一個觸發器

D。為工資表資料輸入編寫一個程式進行控制

8、Select 語句中用來連線字串的符號是______.

A. “+” B. “&” C.“||” D.“|”

9、你是一個出版公司的資料庫開發人員,對特定的書名的每天的銷售情況建立了如下的儲存過程:

CREATE PROCEDURE get_sales_for_title

title varchar(80), @ytd_sales int OUTPUT

AS

SELECT @ytd_sales = ytd_sales

FROM titles

WHERE title = @title

IF @@ROWCOUNT = 0

RETURN(-1)

ELSE

RETURN(0)

另外建立了一個指令碼執行這個儲存過程,如果執行成功,將返回對應於書名的每天的銷售情況的報表,如果執行失敗,將返回“No Sales Found”,怎樣建立這個指令碼?

A. DECLARE @retval int

DECLARE @ytd int

EXEC get_sales_for_title ‘Net Etiquette’, @ytd

IF @retval < 0

PRINT ‘No sales found’

ELSE

PRINT ‘Year to date sales: ’ + STR (@ytd)

GO

B. DECLARE @retval int

DECLARE @ytd int

EXEC get_sales_for_title ‘Net Etiquette’, @ytd OUTPUT

IF @retval < 0

PRINT ‘No sales found’

ELSE

PRINT ‘Year to date sales: ’ + STR (@ytd)

GO

C. DECLARE @retval int

DECLARE @ytd int

EXEC get_sales_for_title ‘Net Etiquette’,@retval OUTPUT

IF @retval < 0

PRINT ‘No sales found’

ELSE

PRINT ‘Year to date sales: ’ + STR (@ytd)

GO

D. DECLARE @retval int

DECLARE @ytd int

EXEC @retval = get_sales_for_title ‘Net Etiquette’, @ytd OUTPUT

IF @retval < 0

PRINT ‘No sales found’

ELSE

PRINT ‘Year to date sales: ’ + STR (@ytd)

GO

10、You are a database developer for a container manufacturing company. The containers produced by your company are a number of different sizes and shapes. The tables that store the container information are shown in the Size, Container, and Shape Tables exhibit:

Size

SizeID

SizeName

Height

Container

ContainerID

ShapeID

SizeID

Shape

ShapeID

ShapeName

Measurements

A sample of the data stored in the tables is shown below:

Size Table

SizeID SizeName Height

1 Small 40

2 Medium 60

3 Large 80

4 Jumbo 100

Shape Table

ShapeID ShapeName Measurement

1 Triangle 10

2 Triangle 20

3 Triangle 30

4 Square 20

5 Square 30

6 Square 40

7 Circle 15

8 Circle 25

9 Circle 35

Periodically, the dimensions of the containers change. Frequently, the database users require the volume of a container. The volume of a container is calculated based on information in the shape and size tables.

You need to hide the details of the calculation so that the volume can be easily accessed in a SELECT query with the rest of the container information. What should you do?

A. Create a user-defined function that requires ContainerID as an argument and returns the volume of the container.

B. Create a stored procedure that requires ContainerID as an argument and returns the volume of the container.

C. Add a column named volume to the container table. Create a trigger that calculates and stores volume in this column when a new container is inserted into the table.

D. Add a computed column to the container table that calculates the volume of the container.