数据库开发面试题(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文档下载到电脑

精彩图片

热门精选

大家正在看

× 游客快捷下载通道(下载后可以自由复制和排版)

限时特价:7 元/份 原价:20元

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219