手机版

数据库开发面试题(7)

发布时间:2021-06-05   来源:未知    
字号:

How can I find authors with the same last name?

You can use the table authors in datatabase pubs. I want to get the result as below: Output:

?程序代码

au_lname???????????????????????????????? number_dups

---------------------------------------- -----------

Ringer?????????????????????????????????? 2

(1 row(s) affected)

Answer 3

select au_lname,number_dups=count(1) from authors group by au_lname

Question4:Can you create a cross-tab report in my SQL Server!

How can I get the report about sale quality for each store and each quarter and the total sale quality for each quarter at year 1993?

You can use the table sales and stores in datatabase pubs.

Table Sales record all sale detail item for each store. Column store_id is the id of each store, ord_date is the order date of each sale item, and column qty is the sale qulity. Table stores record all store information.

I want to get the result look like as below:

Output:

?程序代码

stor_name??????????????????????????????? Total?????? Qtr1??????? Qtr2??????? Qtr3??????? Qtr4???????

---------------------------------------- ----------- ----------- ----------- ----------- -----------

Barnum's???????????????????????????????? 50????????? 0?????????? 50????????? 0?????????? 0

Bookbeat???????????????????????????????? 55????????? 25????????? 30????????? 0?????????? 0

Doc-U-Mat: Quality Laundry and Books???? 85????????? 0?????????? 85????????? 0?????????? 0

Fricative Bookshop?????????????????????? 60????????? 35????????? 0?????????? 0?????????? 25

?

Answer 4:用动态SQL实现

Total??????????????????????????????????? 250???????? 60????????? 165???????? 0?????????? 25

Question5: The Fastest Way to Recompile All Stored Procedures

I have a problem with a database running in SQL Server 6.5 (Service Pack 4). We moved the database (object transfer) from one machine to another last night, and an error (specific to a stored procedure) is cropping up. However, I can't tell which procedure is causing it. Permissions are granted in all of our stored procedures; is there a way from the isql utility to force all stored procedures to recompile?

Tips: sp_recompile can recomplie a store procedure each time

Answer 5:在执行存储过程时,使用 with recompile 选项强制编译新的计划;使用

数据库开发面试题(7).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
×
二维码
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)