- 浏览: 541796 次
- 性别:
- 来自: 天津
文章分类
- 全部博客 (230)
- java (87)
- c/c++/c# (39)
- ASP.net MVC (4)
- eclipse/visual studio (3)
- tomcat/weblogic/jetty (13)
- linux/unix/windows (20)
- html/javascript/jquery/kendo/bootstrap/layui/vue/react (31)
- hibernate/struts/spring/mybatis/springboot (21)
- lucene/solr/ELK (2)
- shiro (0)
- oracle/sqlserver/mysql/postgresql (23)
- shell/python/ruby (6)
- android (0)
- maven/ant (1)
- freemarker/thymeleaf/velocity (1)
- open source project (41)
- cache/memcached/redis (0)
- nosql/hadoop/hbase/mongodb (0)
- system architecture/dubbo/zookeeper (0)
- software testing (0)
- system optimization (0)
- system security (0)
- tcp/udp/http (2)
- roller/wordpress (2)
- 工具收藏 (8)
- 文摘 (4)
- 生活 (0)
最新评论
-
coconut_zhang:
这个demo 非常完整了,是指下面说的那个html 模版,模版 ...
flying sauser, thymeleaf实现PDF文件下载 -
a93456:
你好,你有完整的demo吗? String template这 ...
flying sauser, thymeleaf实现PDF文件下载 -
yujiaao:
fn 函数循环是没有必要的啊,可以改成
protecte ...
Java 笛卡尔积算法的简单实现 -
安静听歌:
设置了.setUseTemporaryFileDuringWr ...
使用jxl导出大数据量EXCEL时内存溢出的解决办法 -
q280499693:
写的很详细,但是我现在想知道他们是怎么定位log4j.prop ...
关于SLF4J结合Log4j使用时日志输出与指定的log4j.properties不同
Question 1:Can you use a batch SQL or store procedure to calculating the Number of Days in a Month
Answer 1:找出当月的天数
select datepart(dd,dateadd(dd,-1,dateadd(mm,1,cast(cast(year(getdate()) as varchar)+'-'+cast(month(getdate()) as varchar)+'-01' as datetime))))
Question2:Can you use a SQL statement to calculating it!
How can I print "10 to 20" for books that sell for between $10 and $20,"unknown" for books whose price is null, and "other" for all other prices?
Answer 2:
select bookid,bookname,price=case when price is null then 'unknown'
when price between 10 and 20 then '10 to 20' else price end
from books
Question3:Can you use a SQL statement to finding duplicate values!
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
Total 250 60 165 0 25
Answer 4:用动态SQL实现
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 选项强制编译新的计划;使用sp_recompile系统存储过程强制在下次运行时进行重新编译
Question6: How can I add row numbers to my result set?
In database pubs, have a table titles , now I want the result shown as below,each row have a row number, how can you do that?
Result:
line-no title_id
----------- --------
1 BU1032
2 BU1111
3 BU2075
4 BU7832
5 MC2222
6 MC3021
7 MC3026
8 PC1035
9 PC8888
10 PC9999
11 PS1372
12 PS2091
13 PS2106
14 PS3333
15 PS7777
16 TC3218
17 TC4203
18 TC7777
Answer 6:
--SQL 2005的写法
select row_number() as line_no ,title_id from titles
--SQL 2000的写法
select line_no identity(int,1,1),title_id into #t from titles
select * from #t
drop table #t
Question 7: Can you tell me what the difference of two SQL statements at performance of execution?
Statement 1:
if NOT EXISTS ( select * from publishers where state = 'NY')
begin
Select 'Sales force needs to penetrate New York market'
end
else
begin
Select 'We have publishers in New York'
end
Statement 2:
if EXISTS ( select * from publishers where state = 'NY')
begin
Select 'We have publishers in New York'
end
else
begin
Select 'Sales force needs to penetrate New York market'
end
Answer 7:不同点:执行时的事务数,处理时间,从客户端到服务器端传送的数据量大小
Question8: How can I list all California authors regardless of whether they have written a book?
In database pubs, have a table authors and titleauthor , table authors has a column state, and titleauhtor have books each author written.
CA behalf of california in table authors.
Answer 8:
select * from authors where state='CA'
Question9: How can I get a list of the stores that have bought both 'bussiness' and 'mod_cook' type books?
In database pubs, use three table stores,sales and titles to implement this requestment.
Now I want to get the result as below:
stor_id stor_name
------- ----------------------------------------
…
7896 Fricative Bookshop
…
…
…
Answer 9:
select distinct a.stor_id, a.stor_name from stores a,sales b,titles c
where a.stor_id=b.stor_id and b.title_id=c.title_id and c.type='business' and
exists(select 1 from sales k,titles g where stor_id=b.stor_id
and k.title_id=g.title_id and g.type='mod_cook')
Question10: How can I list non-contignous data?
In database pubs, I create a table test using statement as below, and I insert several row as below
create table test
( id int primary key )
go
insert into test values (1 )
insert into test values (2 )
insert into test values (3 )
insert into test values (4 )
insert into test values (5 )
insert into test values (6 )
insert into test values (8 )
insert into test values (9 )
insert into test values (11)
insert into test values (12)
insert into test values (13)
insert into test values (14)
insert into test values (18)
insert into test values (19)
go
Now I want to list the result of the non-contignous row as below,how can I do it?
Missing after Missing before
------------- --------------
6 8
9 11
…
Answer 10:
select id from test t where not exists(select 1 from test where id=t.id+1)
or not exists(select 1 from test where id=t.id-1)
Question11: How can I list all book with prices greather than the average price of books of the same type?
In database pubs, have a table named titles , its column named price mean the price of the book, and another named type mean the type of books.
Now I want to get the result as below:
type title price
------------ -------------------------------------------------------------------------------- ---------------------
business The Busy Executive's Database Guide 19.9900
…
…
…
…
Answer 11:
select a.type,a.title,a.price from titles a,
(select type,price=avg(price) from titles group by type)b
where a.type=b.type and a.price>b.price
试题点评:通览整个试题,我们不难发现,这份试题是针对SQL Server数据库人员的。而从难度分析上来看,这份试题也属于同类试题中比较难的了。之所以说它难,首先是限定时间的全英文试题;其次,尽管这份试题主要是考核开发能力,但却涉及到了算法的选择和性能的调优;最后,这份试题还夹进了SQL Server数据库的升级问题。因此,综上所述,我们估计这是一家从事程序外包工作的外企招聘后台开发或与后台开发相关的SQL Server高级程序员的试题。
Answer 1:找出当月的天数
select datepart(dd,dateadd(dd,-1,dateadd(mm,1,cast(cast(year(getdate()) as varchar)+'-'+cast(month(getdate()) as varchar)+'-01' as datetime))))
Question2:Can you use a SQL statement to calculating it!
How can I print "10 to 20" for books that sell for between $10 and $20,"unknown" for books whose price is null, and "other" for all other prices?
Answer 2:
select bookid,bookname,price=case when price is null then 'unknown'
when price between 10 and 20 then '10 to 20' else price end
from books
Question3:Can you use a SQL statement to finding duplicate values!
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
Total 250 60 165 0 25
Answer 4:用动态SQL实现
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 选项强制编译新的计划;使用sp_recompile系统存储过程强制在下次运行时进行重新编译
Question6: How can I add row numbers to my result set?
In database pubs, have a table titles , now I want the result shown as below,each row have a row number, how can you do that?
Result:
line-no title_id
----------- --------
1 BU1032
2 BU1111
3 BU2075
4 BU7832
5 MC2222
6 MC3021
7 MC3026
8 PC1035
9 PC8888
10 PC9999
11 PS1372
12 PS2091
13 PS2106
14 PS3333
15 PS7777
16 TC3218
17 TC4203
18 TC7777
Answer 6:
--SQL 2005的写法
select row_number() as line_no ,title_id from titles
--SQL 2000的写法
select line_no identity(int,1,1),title_id into #t from titles
select * from #t
drop table #t
Question 7: Can you tell me what the difference of two SQL statements at performance of execution?
Statement 1:
if NOT EXISTS ( select * from publishers where state = 'NY')
begin
Select 'Sales force needs to penetrate New York market'
end
else
begin
Select 'We have publishers in New York'
end
Statement 2:
if EXISTS ( select * from publishers where state = 'NY')
begin
Select 'We have publishers in New York'
end
else
begin
Select 'Sales force needs to penetrate New York market'
end
Answer 7:不同点:执行时的事务数,处理时间,从客户端到服务器端传送的数据量大小
Question8: How can I list all California authors regardless of whether they have written a book?
In database pubs, have a table authors and titleauthor , table authors has a column state, and titleauhtor have books each author written.
CA behalf of california in table authors.
Answer 8:
select * from authors where state='CA'
Question9: How can I get a list of the stores that have bought both 'bussiness' and 'mod_cook' type books?
In database pubs, use three table stores,sales and titles to implement this requestment.
Now I want to get the result as below:
stor_id stor_name
------- ----------------------------------------
…
7896 Fricative Bookshop
…
…
…
Answer 9:
select distinct a.stor_id, a.stor_name from stores a,sales b,titles c
where a.stor_id=b.stor_id and b.title_id=c.title_id and c.type='business' and
exists(select 1 from sales k,titles g where stor_id=b.stor_id
and k.title_id=g.title_id and g.type='mod_cook')
Question10: How can I list non-contignous data?
In database pubs, I create a table test using statement as below, and I insert several row as below
create table test
( id int primary key )
go
insert into test values (1 )
insert into test values (2 )
insert into test values (3 )
insert into test values (4 )
insert into test values (5 )
insert into test values (6 )
insert into test values (8 )
insert into test values (9 )
insert into test values (11)
insert into test values (12)
insert into test values (13)
insert into test values (14)
insert into test values (18)
insert into test values (19)
go
Now I want to list the result of the non-contignous row as below,how can I do it?
Missing after Missing before
------------- --------------
6 8
9 11
…
Answer 10:
select id from test t where not exists(select 1 from test where id=t.id+1)
or not exists(select 1 from test where id=t.id-1)
Question11: How can I list all book with prices greather than the average price of books of the same type?
In database pubs, have a table named titles , its column named price mean the price of the book, and another named type mean the type of books.
Now I want to get the result as below:
type title price
------------ -------------------------------------------------------------------------------- ---------------------
business The Busy Executive's Database Guide 19.9900
…
…
…
…
Answer 11:
select a.type,a.title,a.price from titles a,
(select type,price=avg(price) from titles group by type)b
where a.type=b.type and a.price>b.price
试题点评:通览整个试题,我们不难发现,这份试题是针对SQL Server数据库人员的。而从难度分析上来看,这份试题也属于同类试题中比较难的了。之所以说它难,首先是限定时间的全英文试题;其次,尽管这份试题主要是考核开发能力,但却涉及到了算法的选择和性能的调优;最后,这份试题还夹进了SQL Server数据库的升级问题。因此,综上所述,我们估计这是一家从事程序外包工作的外企招聘后台开发或与后台开发相关的SQL Server高级程序员的试题。
发表评论
-
MySQL 5.6 for Windows 解压缩版配置安装
2016-04-22 09:55 451MySQL是一个小巧玲珑但功能强大的数据库, ... -
PL/SQL编程
2011-04-10 20:00 1145《PL/SQL编程》 ... -
EXP-××××: 问题处理方法(整理中..)
2011-01-30 10:31 15701.EXP-00091: Exporting question ... -
oracle 10g备份与还原总结
2010-06-18 15:49 1668核心提示:一.总述 1.数据库归档模式: * 非归档模式: ... -
oem 报错“java.lang.Exception: IOException in send……”
2010-04-26 13:47 2252oracle 10g R2 登陆EM管理控制台,题头报错如下: ... -
修改Oracle最大连接数
2010-04-26 08:48 10571、修改Oracle最大连接数的方法 a、以sysd ... -
oracle更改字符集步骤方法
2010-04-26 08:45 1536oracle9204更改字符集步骤方法(WE8ISO8859P ... -
oracle触发器使用笔记
2009-12-01 11:17 1167语法规则: Create [or repla ... -
TKPROF使用学习
2009-11-19 15:16 2678Tkprof工具可用来格式化s ... -
卸载Oracle,重新安装Oracle
2009-08-10 12:51 14521、 开始->设置->控制面板->管理工具->服务 ... -
Oracle中用Rowid查找和删除重复记录
2009-07-30 13:38 1308平时工作中可能会碰到当试图对库表中的某一列或几列创建唯一索引时 ... -
数据库设计多对多关系的几种形态
2009-06-29 13:37 2282前言:多对多关系至少需要3个表,我们把一个表叫做主表,一个叫做 ... -
Oracle中用exp/imp命令快速导入导出数据(整理)
2009-06-11 14:28 2142【用 exp 数 据 导 出】 ... -
Oracle创建自增字段方法-ORACLE SEQUENCE的简单介绍
2009-06-11 14:15 1211先假设有这么一个表: ... -
一些不错的sql语句
2008-12-02 17:34 22091、说明:复制表(只复制结构,源表名:a 新表名:b) ... -
表操作
2009-01-12 11:23 1078新建表:create table [表名]([自动编号字段] ... -
通用数据库存储过程代码--高效分页存储过程
2009-04-04 23:38 1349-- 获取指定页的数据 Create PROCEDURE p ... -
千万数量级分页存储过程
2009-04-04 23:36 1126参数说明: 1.Tables :表名称,视图 2.Primar ... -
存储过程编写经验和优化措施
2009-04-04 23:34 978一、前言:在经过一段 ... -
数据库面试(Oracle与Sql专题)
2009-04-04 23:16 1918oracle Certification Program (O ...
相关推荐
* SQL Server 面试题涵盖了数据库管理、数据模型、SQL 语言、Transact-SQL 等多方面的知识点 * 本资源提供了 19 道 SQL Server 面试题,涵盖了数据模型、实体关系、SQL 语言、Transact-SQL 等多方面的知识点。
在SQL Server数据库领域,DBA(Database Administrator,数据库管理员)的角色至关重要。他们负责数据库的设计、实施、监控、优化以及安全等方面的工作。以下是一些在DBA面试中可能会遇到的SQL Server相关知识点,...
以上是对SQL Server面试题的详细解答,涵盖了磁盘配置、集群管理、复制策略、索引优化、备份策略、数据库管理和DBA素质等多个方面,旨在全面展示SQL Server的相关知识和实际操作经验。这些问题的答案有助于面试者...
SQL Server 面试题 本文总结了 SQL Server 相关的知识点,涵盖了 SQL 语句的编写、查询优化、表合并、union 和 union all 的区别等内容。 一、查询优化 在 SQL Server 中,查询优化是非常重要的。通过编写高效的 ...
这篇文档“SQLServer面试题.doc”显然包含了与SQL Server相关的面试问题,可能是为了帮助求职者准备数据库管理员(DBA)、数据库开发人员或数据分析职位的面试。以下是一些可能出现在SQL Server面试中的关键知识点:...
以下是针对给定的Oracle数据库DBA面试题的知识点详细解析: 1. **冷备份和热备份的区别及其优点**: - **热备份**:在数据库运行时(归档模式下)进行备份。优点是可以使用数据库,且可将数据库恢复到任意时间点。...
以上就是针对SQL Server 2008数据库面试题可能涵盖的关键知识点,熟练掌握这些内容将极大地提高面试成功的机会。文件`十二道数据库连接面试题.sql`可能包含具体的题目,实际解答时需要结合这些题目深入探讨。
【SQL Server 2005面试题解析】 1. 数据库系统的核心组成部分包括数据库(DB)、数据库管理系统(DBMS)、数据库管理员(DBA)以及操作系统(OS)和计算机硬件。选项D正确,它概括了数据库系统的基础架构。 2. 在...
### SQL Server数据库管理员(DBA)面试题解析 #### 标题与描述中的知识点解析: **SQL Server数据库管理员(DBA)面试题**这一标题表明了本文档主要关注的是针对SQL Server数据库管理员岗位的面试题目及其解答思路。...
国外DBA面试题 Oracle DBA面试题
DBA面试题 Oracle 本文总结了 Oracle 数据库管理员(DBA)面试中的一些重要知识点,从表连接方式、执行计划、CBO 和 RBO、SQL 调整、索引、绑定变量、执行计划、排序等方面进行了详细的解释。 一、表连接方式 在 ...
### SQL Server DBA 名企面试问题及答案 #### 1. 磁盘柜配置与数据库物理部署 **问题背景**:给定一个磁盘柜,包含14块73G的磁盘,需要配置以支持一个200G大小(含日志文件)的数据库。 **解决方案**: - **RAID...
【MySQL数据库高级工程师面试知识点详解】 在MySQL数据库高级工程师的...以上这些知识点是MySQL DBA面试中可能会遇到的重点,深入理解和实践这些内容,将有助于你顺利通过面试并成为一名优秀的MySQL数据库高级工程师。
DBA常见理论面试题 以下是对给定文件的知识点总结: 数据库基础概念 * char、varchar、nvarchar之间的区别:char是固定长度字符串,varchar是可变长度字符串,nvarchar是unicode字符集的可变长度字符串。它们的...
数据库面试题-DBA数据库管理员 以下是从给定的文件中生成的相关知识点: 1. 数据抽象: 数据抽象是指数据库管理系统中对数据的抽象表示,可以分为物理抽象、概念抽象和视图级抽象。物理抽象关心的是数据的物理存储...
### Oracle数据库DBA面试题详解 #### 1. 解释冷备份和热备份的不同点以及各自的优点 - **冷备份**:这是一种简单的物理文件复制方式,通常在数据库完全关闭的情况下进行。冷备份适用于所有模式的数据库,无论是...
SQL数据库面试题及答案,希望有帮助!有志于成为sql dba的可以看看。谢谢
以下是对SQL数据库基础面试题的解析,帮助你复习并准备相关考试。 1. SQLServer数据库的主数据文件扩展名是.mdf(选项D)。这代表了主要数据文件,其中存储了数据库的表、索引和其他对象。 2. 在SQL Server中,不...
DBA_SQL 查询面试题 本资源提供了 DBA_SQL 面试题,涵盖了 SQL 查询的基本概念和高级应用,涉及到嵌套语句、连接查询、子查询、分组和聚合函数等多个知识点。 知识点 1: 嵌套语句查询 知识点描述:使用标准 SQL ...
Oracle数据库DBA面试题涵盖了数据库管理的多个关键领域,包括备份与恢复、数据库配置、数据存储、索引优化、约束、数据库性能监控等。以下是对这些知识点的详细说明: 1. **冷备份与热备份**:冷备份是在数据库关闭...