DBA面试题

当前位置: 面试问题网 > DBA面试题 > 北京SQL新华信咨询

北京SQL新华信咨询

选择题:(每空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.

【北京SQL新华信咨询】相关文章

1. 北京SQL新华信咨询

2. mysql_pconnect()和mysql_connect()有什么区别

3. 写一个在SQL Server创建表的SQL语句

4. 北京华建集团SQL面试题

5. 新华社国际部笔试面试经历

6. 新华社分社笔试面试分享

7. SQL注入攻击的种类有哪些

8. 什么叫做SQL注入,如何防止

9. Ibatis中如何提高SQL Map的性能

10. Tomcat Mysql datasource数据源配置

本文来源:https://www.mianshiwenti.com/a13388.html

点击展开全部

《北京SQL新华信咨询》

将本文的Word文档下载到电脑,方便收藏和打印

推荐程度:

进入下载页面

﹝北京SQL新华信咨询﹞相关内容

「北京SQL新华信咨询」相关专题

其它栏目

也许您还喜欢