當前位置:學者齋 >

IT認證 >NIIT認證 >

NIITsql選擇題考試題庫

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.

  • 文章版權屬於文章作者所有,轉載請註明 https://xuezhezhai.com/zh-hk/itrz/niitrz/0e2z0.html