哪里有SQL server 试题 我正在学习sql server 2005,我想找点练习题。

\u6211\u662fSQL Server\u7684\u65b0\u5b66\u5458\u60f3\u77e5\u9053\u54ea\u91cc\u53ef\u4ee5\u627e\u5230\u7ec3\u4e60

\u770b\u770b\u8fd9\u4e2a\u7136\u540e\u81ea\u5df1\u5728\u6539\u6539\uff1a

http://blog.csdn.net/zjcxc/article/details/385114
\u8fd8\u6709\u767e\u5ea6\u6587\u5e93\u8fd9\u6837\u7684\u4e1c\u897f\u5f88\u591a\u554a

\u6211\u8fd9\u5012\u662f\u6709\u4e24\u4e2a;\u7ec3\u4e60 \u4f46\u662f\u662fword\u6587\u6863 \u4e0d\u597d\u590d\u5236\u8fdb\u6765 \u53ea\u80fd\u590d\u5236\u70b9\u7b14\u8bd5\u9898 \u8981\u673a\u8bd5\u9898\u8bf7\u53d1\u7ed9\u90ae\u4ef6\u7ed9\u6211 \u6211\u7ed9\u4f60\u4f20\u8fc7\u6765 \u90ae\u4ef6\u4e2d\u8bf4\u660e \u662f\u76ee\u7684 \u4e0d\u7136\u6211\u4e0d\u77e5\u9053\u4f1a\u5f53\u5783\u573e\u90ae\u4ef6\u5904\u7406\u7684 \u6211\u7684\u90ae\u7bb1\u662f [email protected]

\u9488\u5bf9\u4ee5\u4e0b\u9898\u76ee\u8bf7\u9009\u62e9\u6b63\u786e\u7b54\u6848\uff08\u6bcf\u9053\u9898\u76ee\u6709\u4e00\u4e2a\u6216\u591a\u4e2a\u6b63\u786e\u7684\u7b54\u6848\uff09\u3002\u9488\u5bf9\u6bcf\u4e00\u9053\u9898\u76ee\uff0c\u6240\u6709\u7b54\u6848\u90fd\u9009\u5bf9\uff0c\u5219\u8be5\u9898\u5f97\u5206\uff0c\u5426\u5219\u4e0d\u5f97\u5206\u3002
1. \u6570\u636e\u5e93\u8bbe\u8ba1\u7684\u6700\u7ec8\u76ee\u6807\u4e0d\u5305\u62ec\uff08\uff09\u3002 \uff08\u9009\u62e9\u4e24\u9879\uff09BD
A. \u9ad8\u6548
B. \u6ee1\u8db3\u8303\u5f0f\u8981\u6c42
C. \u5b89\u5168
D. \u8868\u73b0\u8bbe\u8ba1\u8005\u7684\u6280\u672f\u5b9e\u529b
E. \u6613\u7528
F. \u4fbf\u4e8e\u5c06\u6765\u6269\u5c55\u529f\u80fd\u548c\u5bb9\u91cf
2. \u6709\u5173\u6570\u636e\u5197\u4f59\u8bf4\u6cd5\u9519\u8bef\u7684\u662f\uff08\uff09\u3002\uff08\u9009\u62e9\u4e00\u9879\uff09C
A. \u6570\u636e\u5e93\u4e2d\uff0c\u6570\u636e\u5b58\u5728\u526f\u672c\u7684\u73b0\u8c61\uff0c\u5c31\u662f\u6570\u636e\u5197\u4f59\u3002
B. \u901a\u8fc7\u5206\u7c7b\u5b58\u50a8\uff0c\u53ef\u4ee5\u6709\u6548\u51cf\u5c11\u6570\u636e\u5197\u4f59\uff0c\u4f46\u662f\u4f1a\u589e\u52a0\u6570\u636e\u67e5\u627e\u7684\u590d\u6742\u6027\u3002
C. \u5728\u6570\u636e\u5e93\u8bbe\u8ba1\u9636\u6bb5\uff0c\u4e00\u5b9a\u8981\u5c3d\u6700\u5927\u53ef\u80fd\u907f\u514d\u6570\u636e\u5197\u4f59\uff0c\u6700\u597d\u505a\u5230\u65e0\u6570\u636e\u5197\u4f59\u3002
D. \u6570\u636e\u5197\u4f59\u901a\u5e38\u662f\u7531\u4e8e\u6570\u636e\u5e93\u8bbe\u8ba1\u5f15\u8d77\u7684\u3002
3. \u7528\u4e8e\u8868\u793a\u6570\u636e\u5e93\u5b9e\u4f53\u4e4b\u95f4\u7684\u5173\u7cfb\u56fe\u662f\uff08\uff09\u3002A
A. \u5b9e\u4f53\u5173\u7cfb\u56fe
B. \u6570\u636e\u6a21\u578b\u56fe
C. \u5b9e\u4f53\u5206\u7c7b\u56fe
D. \u4ee5\u4e0a\u90fd\u4e0d\u662f
4. \u5047\u5b9a\u6709\u4e00\u4e2a\u7528\u6237\u8868\uff0c\u8868\u4e2d\u5305\u542b\u5b57\u6bb5\uff1auserid (int)\u3001username (varchar)\u3001 password(varchar)\u7b49\uff0c\u8be5\u8868\u9700\u8981\u8bbe\u7f6e\u4e3b\u952e\uff0c\u4ee5\u4e0b\u8bf4\u6cd5\u6b63\u786e\u7684\u662f\uff08\uff09\u3002\uff08\u9009\u62e9\u4e24\u9879\uff09AB
A. \u5982\u679c\u4e0d\u80fd\u6709\u540c\u65f6\u91cd\u590d\u7684username\u548cpassword\uff0c\u90a3\u4e48username\u548cpassword\u53ef\u4ee5\u7ec4\u5408\u5728\u4e00\u8d77\u4f5c\u4e3a\u4e3b\u952e\u3002
B. \u6b64\u8868\u8bbe\u8ba1\u4e3b\u952e\u65f6\uff0c\u6839\u636e\u9009\u62e9\u4e3b\u952e\u7684\u6700\u5c0f\u6027\u539f\u5219\uff0c\u6700\u597d\u91c7\u7528userid\u4f5c\u4e3a\u4e3b\u952e\u3002
C. \u6b64\u8868\u8bbe\u8ba1\u4e3b\u952e\u65f6\uff0c\u6839\u636e\u9009\u62e9\u4e3b\u952e\u7684\u6700\u5c0f\u6027\u539f\u5219\uff0c\u6700\u597d\u91c7\u7528username\u548cpassword\u4f5c\u4e3a\u7ec4\u5408\u952e\u3002
D. \u5982\u679c\u91c7\u7528userid\u4f5c\u4e3a\u4e3b\u952e\uff0c\u90a3\u4e48\u5728userid\u5217\u8f93\u5165\u7684\u6570\u503c\uff0c\u5141\u8bb8\u4e3a\u7a7a\u3002
5. \u8bed\u53e5 alter table userinfo add constraint uq_userid unique(userid)\u6267\u884c\u6210\u529f\u540e\uff0c\u4e3auserinfo\u8868\u7684\uff08\uff09\u5b57\u6bb5\u6dfb\u52a0\u4e86\uff08\uff09\u7ea6\u675f\u3002B
A. userid \u4e3b\u952e
B. userid \u552f\u4e00
C. uq_userid \u5916\u952e
D. uq_userid \u68c0\u67e5
6. \u8fd0\u884c\u5982\u4e0bT-SQL\uff0c\u7ed3\u679c\u8fd4\u56de\u5305\u542b\uff08\uff09\u7684\u8bb0\u5f55\u96c6\u3002A
create table scores
(
scoreid int identity(1,2),
score numeric(4,2) not null,
courseid int
)
insert int scores values(90.5,null);
insert into scores values(78.234,2);
select * from scores;
A. 1 90.50 NULL
3 78.23 2
B. 1 78.23 2
C. 1 90.50
D. 1 90.50
2 78.23 2
7. \u5173\u4e8e\u5b50\u67e5\u8be2\uff0c\u4ee5\u4e0b\u8bf4\u6cd5\u6b63\u786e\u7684\u662f\uff08\uff09\u3002\uff08\u9009\u62e9\u4e24\u9879\uff09AC
A. \u4e00\u822c\u6765\u8bf4\uff0c\u8868\u8fde\u63a5\u90fd\u53ef\u4ee5\u7528\u5b50\u67e5\u8be2\u66ff\u6362\u3002
B. \u4e00\u822c\u6765\u8bf4\uff0c\u5b50\u67e5\u8be2\u90fd\u53ef\u4ee5\u7528\u8868\u8fde\u63a5\u66ff\u6362\u3002
C. \u76f8\u5bf9\u4e8e\u8868\u8fde\u63a5\uff0c\u5b50\u67e5\u8be2\u9002\u5408\u4e8e\u4f5c\u4e3a\u67e5\u8be2\u7684\u7b5b\u9009\u6761\u4ef6\u3002
D. \u76f8\u5bf9\u4e8e\u8868\u8fde\u63a5\uff0c\u5b50\u67e5\u8be2\u9002\u5408\u4e8e\u67e5\u770b\u591a\u8868\u7684\u6570\u636e\u3002
8. \u521b\u5efa\u5b58\u50a8\u8fc7\u7a0b\u5982\u4e0b\uff1a
create procedure scoreproc
@scoreid int,@score numeric(4,2) output
as
select @score = score from scores where scoreid=@scoreid
\u6b63\u786e\u7684\u8c03\u7528\u662f\uff1aC
A. exec scoreproc 1,@myscore output
print @myscore
B. exec scoreproc @id = 1,@myscore output
print @myscore
C. declare @myscore numeric(4,2)
exec scoreproc 1,@myscore output
print @myscore
D. declare @myscore numeric(4,2)
exec scoreproc @id = 1,@myscore output
print @myscore
9. \u5047\u8bbe\u9700\u8981\u8bbe\u8ba1\u4e00\u5f20\u8868\uff0c\u8bb0\u5f55\u5404\u4e2a\u4f5c\u8005\u8457\u4f5c\u7684\u6240\u6709\u56fe\u4e66\u4fe1\u606f\uff0c\u8868\u7684\u7ed3\u6784\u5982\u4e0b\uff1a\u4f5c\u8005\uff08\u4f5c\u8005\u540d\u79f0\uff0c\u56fe\u4e661\uff0c\u7248\u672c1\uff0c\u4e66\u4ef71\uff0c\u56fe\u4e66\u4e8c\uff0c\u7248\u672c2\uff0c\u4e66\u4ef72\uff0c\u2026\uff09,\u8be5\u8868\u6700\u591a\u7b26\u5408\u7b2c\uff08\uff09\u8303\u5f0f\u3002A
A. \u4e00
B. \u4e8c
C. \u4e09
D. \u4e0d\u7b26\u5408\u4efb\u4f55\u8303\u5f0f
10. \u4e00\u4e2a\u5b66\u751f\u53ea\u80fd\u5c31\u8bfb\u4e8e\u4e00\u4e2a\u73ed\u7ea7\uff0c\u800c\u4e00\u4e2a\u73ed\u7ea7\u53ef\u4ee5\u540c\u65f6\u5bb9\u7eb3\u591a\u4e2a\u5b66\u751f\uff0c\u5b66\u751f\u4e0e\u73ed\u7ea7\u4e4b\u95f4\u662f\uff08\uff09\u7684\u5173\u7cfb\u3002C
A. \u4e00\u5bf9\u4e00
B. \u4e00\u5bf9\u591a
C. \u591a\u5bf9\u4e00
D. \u591a\u5bf9\u591a
11. E-R\u56fe\u4e2d\uff0c\u5173\u7cfb\u96c6\u7528\u4e0b\u9762\uff08\uff09\u6765\u8868\u793a\u3002B
A. \u77e9\u5f62
B. \u692d\u5706\u5f62
C. \u83f1\u5f62
D. \u5706\u5f62
12. \u6709\u5982\u4e0b\u8868\u7ed3\u6784\uff0c#\u53f7\u6253\u5934\u5b57\u6bb5\u4ee3\u8868\u4e3b\u952e\u6216\u7ec4\u5408\u4e3b\u952e\uff0c\u4e00\u4efd\u8ba2\u5355\u53ef\u4ee5\u8ba2\u8d2d\u591a\u79cd\u4ea7\u54c1\u3002
\u4ea7\u54c1\uff1a#\u4ea7\u54c1\u7f16\u53f7\uff0c\u4ea7\u54c1\u540d\u79f0\uff0c\u4ea7\u54c1\u4ef7\u683c\uff1b
\u8ba2\u5355\uff1a#\u8ba2\u5355\u7f16\u53f7\uff0c#\u4ea7\u54c1\u7f16\u53f7\uff0c\u8ba2\u8d2d\u65e5\u671f\uff0c\u8ba2\u8d2d\u6570\u91cf\uff1b\uff08\u8ba2\u5355\u7f16\u53f7\u4e0e\u4ea7\u54c1\u7f16\u53f7\u662f\u7ec4\u5408\u4e3b\u952e\uff09
\u8be5\u8868\u6700\u9ad8\u7b26\u5408\u7b2c\uff08\uff09\u8303\u5f0f\u3002B
A. \u4e00
B. \u4e8c
C. \u4e09
D. \u672a\u89c4\u8303\u5316\u7684
13. \u6709\u5982\u4e0b\u8868\u7ed3\u6784\uff0c#\u53f7\u6253\u5934\u5b57\u6bb5\u4ee3\u8868\u4e3b\u952e\u6216\u7ec4\u5408\u4e3b\u952e\uff0c\u4e00\u4efd\u8ba2\u5355\u53ef\u4ee5\u8ba2\u8d2d\u591a\u79cd\u4ea7\u54c1\u3002
\u4ea7\u54c1\uff1a#\u4ea7\u54c1\u7f16\u53f7\uff0c\u4ea7\u54c1\u540d\u79f0\uff0c\u4ea7\u54c1\u4ef7\u683c\uff1b
\u8ba2\u5355\uff1a#\u8ba2\u5355\u7f16\u53f7\uff0c\u603b\u4ef7\uff0c\u8ba2\u8d2d\u65e5\u671f\uff1b
\u8ba2\u5355\u5b50\u9879\uff1a #\u5b50\u9879\u7f16\u53f7\uff0c\u8ba2\u5355\u7f16\u53f7\uff0c\u4ea7\u54c1\u7f16\u53f7\uff0c\u8ba2\u8d2d\u6570\u91cf\uff1b
\u8be5\u8868\u6700\u9ad8\u7b26\u5408\u7b2c\uff08\uff09\u8303\u5f0f\u3002C
A. \u4e00
B. \u4e8c
C. \u4e09
D. \u672a\u89c4\u8303\u5316\u7684
14. \u521b\u5efasql\u8bed\u53e5\u5982\u4e0b\uff1a
create table userInfo
(
userId int identity(-1,1), \u7b2c1\u884c
userName nvarchar(20) not null, \u7b2c2\u884c
cardNO char not null, \u7b2c3\u884c
age smallint(2), \u7b2c4\u884c
address ntext(300) \u7b2c5\u884c
)
\u6267\u884c\u65f6\uff0c\u4f1a\u5728\u7b2c\uff08\uff09\u884c\u51fa\u73b0\u9519\u8bef\u3002\uff08\u9009\u62e9\u4e24\u9879\uff09DE
A. 1
B. 2
C. 3
D. 4
E. 5
15. \u4ee5\u4e0b\u5173\u4e8e\u89c4\u8303\u8bbe\u8ba1\u7684\u63cf\u8ff0\u6b63\u786e\u7684\u662f\uff08\uff09\u3002\uff08\u9009\u62e9\u4e24\u9879\uff09AD
A. \u89c4\u8303\u8bbe\u8ba1\u7684\u4e3b\u8981\u76ee\u7684\u662f\u6d88\u9664\u6570\u636e\u5197\u4f59\u3002
B. \u89c4\u8303\u8bbe\u8ba1\u5f80\u5f80\u4f1a\u589e\u52a0\u6570\u636e\u5e93\u7684\u6027\u80fd\u3002
C. \u8bbe\u8ba1\u6570\u636e\u5e93\u65f6\uff0c\u89c4\u8303\u5316\u7a0b\u5ea6\u8d8a\u9ad8\u8d8a\u597d\u3002
D. \u5728\u89c4\u8303\u5316\u6570\u636e\u5e93\u65f6\uff0c\u6613\u4e8e\u7ef4\u62a4\u6570\u636e\u5e93\u7684\u5b8c\u6574\u6027\u3002
16. \u5173\u4e8e\u5b58\u50a8\u8fc7\u7a0b\uff0c\u4ee5\u4e0b\u8bf4\u6cd5\u6b63\u786e\u7684\u662f\uff08\uff09\u3002\uff08\u9009\u62e9\u4e00\u9879\uff09A
A. \u4e0d\u80fd\u5728\u5b58\u50a8\u8fc7\u7a0b\u4e2d\u4f7f\u7528CREATE VIEW\u547d\u4ee4\u3002
B. T-SQL\u6279\u4ee3\u7801\u7684\u6267\u884c\u901f\u5ea6\u8981\u5feb\u4e8e\u5b58\u50a8\u8fc7\u7a0b\u3002
C. \u5b58\u50a8\u8fc7\u7a0b\u5fc5\u987b\u5e26\u6709\u53c2\u6570\u3002
D. \u5b58\u50a8\u8fc7\u7a0b\u4e0d\u80fd\u8fd4\u56de\u7ed3\u679c\u96c6\u3002
17. \u5df2\u77e5\u6709scores\u8868\uff0cscoreid\u4e3a\u4e3b\u952e\uff0c\u73b0\u5728\u8868\u4e2d\u5171\u670910\u6761\u8bb0\u5f55\uff0c\u5176\u4e2d\u4e00\u6761scoreid=21\u3002
\u521b\u5efa\u89c6\u56fe\uff1a
create view view_scores
as
select * from scores
\u6267\u884c\u5982\u4e0b\u547d\u4ee4\uff1a
delete from view_scores where (scoreid = 21)
\u518d\u6267\u884c\u5982\u4e0b\u547d\u4ee4\uff1a
select * from scores
select * from view_scores
\u5047\u5b9a\u4e0a\u8ff0\u547d\u4ee4\u5168\u90e8\u6267\u884c\u6210\u529f\uff0c\u5c06\u5404\u81ea\u8fd4\u56de\uff08\uff09\uff08\uff09\u884c\u8bb0\u5f55\u3002D
A. 10\uff0c10
B. 10\uff0c9
C. 9\uff0c10
D. 9\uff0c9
18. \u8bbe\u8ba1\u7528\u6237\u8868\u65f6\uff0c\u8eab\u4efd\u8bc1\u53f7\u4e3a\u56fa\u5b9a18\u4f4d\u957f\uff0c\u5bf9\u8be5\u5b57\u6bb5\u6700\u597d\u91c7\u7528\uff08\uff09\u6570\u636e\u7c7b\u578b\u3002\uff08\u9009\u62e9\u4e00\u9879\uff09B
A. int
B. char
C. varchar
D. text
19. \u6388\u4e88\u7528\u6237someone\u5bf9scores\u8868\u7684\u4e00\u4e9b\u6743\u9650\uff0c\u6b63\u786e\u7684\u6388\u6743\u8bed\u53e5\u662f\uff08\uff09\u3002\uff08\u9009\u62e9\u4e00\u9879\uff09C
A. grant insert , update to talbe scores on someone
B. grant insert and update to table scores on someone
C. grant insert , update on scores to someone
D. grant insert and update on scores to someone
20. \u5efa\u7acb\u5982\u4e0b\u6570\u636e\u5e93\u8868\uff1a
create talbe Department(
departID int not null primary key,
deptName varchar(20) not null
)
create table Employee(
employeeID int not null,
deptID int not null,
name varchar(20) not null
)
\u8981\u60f3\u4fdd\u8bc1Employee\u8868\u4e2d\u6bcf\u4e00\u4e2a\u96c7\u5458\uff08employee\uff09\u662f\u552f\u4e00\u7684,\u4e14\u53ea\u80fd\u5c5e\u4e8e\u5728Department\u8868\u4e2d\u5df2\u7ecf\u5b58\u5728\u7684\u90e8\u95e8\uff0c\u6700\u6709\u7684\u505a\u6cd5\u662f\uff08\uff09\u3002\uff08\u9009\u62e9\u4e00\u9879\uff09B
A. \u628aemployeeID\u548cdeptID\u8bbe\u4e3a\u7ec4\u5408\u4e3b\u952e\u3002
B. \u628aemployeeID\u8bbe\u4e3a\u4e3b\u952e\uff0c\u540c\u65f6\u5728deptID\u5217\u4e0a\u521b\u5efa\u4e00\u4e2a\u5916\u952e\u7ea6\u675f\u3002
C. \u628aemployeeID\u8bbe\u4e3a\u4e3b\u952e\uff0c\u540c\u65f6\u5728deptID\u5217\u4e0a\u521b\u5efa\u4e00\u4e2a\u68c0\u67e5\u7ea6\u675f\u3002
D. \u5728deptID\u5217\u4e0a\u521b\u5efa\u4e00\u4e2a\u552f\u4e00\u7ea6\u675f\uff0c\u540c\u65f6\u5728deptID\u5217\u4e0a\u521b\u5efa\u4e00\u4e2a\u5916\u952e\u7ea6\u675f\u3002
21. \u5efa\u7acb\u4e00\u5f20\u5458\u5de5\u8868\uff0c\u5f53\u5411\u8868\u4e2d\u63d2\u5165\u6570\u636e\u65f6\uff0c\u82e5\u4e0d\u63d0\u4f9b\u5165\u804c\u65f6\u95f4\uff0c\u5c31\u628a\u7cfb\u7edf\u5f53\u524d\u65f6\u95f4\u4f5c\u4e3a\u5458\u5de5\u5165\u804c\u65f6\u95f4\u63d2\u5165\u6570\u636e\u5e93\uff0c\u4ee5\u4e0b\u8bf4\u6cd5\u6b63\u786e\u7684\u662f\uff08\uff09\u3002\uff08\u9009\u62e9\u4e00\u9879\uff09D
A. \u7ea6\u675f\u4e0d\u80fd\u4f7f\u7528\u5404\u79cd\u51fd\u6570\uff0c\u6240\u4ee5\u65e0\u6cd5\u5b9e\u73b0\u8981\u6c42\u7684\u529f\u80fd\u3002
B. \u53ef\u4ee5\u4f7f\u7528CHECK\u7ea6\u675f\u5b9e\u73b0\uff0c\u9ed8\u8ba4\u503c\u91c7\u7528\u65e5\u671f\u51fd\u6570getDate()\u3002
C. \u5165\u804c\u65f6\u95f4\u5fc5\u987b\u8bbe\u4e3a\u65e5\u671f\u7c7b\u578b\u3002
D. \u53ef\u4ee5\u4f7f\u7528DEFAULT\u7ea6\u675f\u5b9e\u73b0\uff0c\u9ed8\u8ba4\u503c\u91c7\u7528\u65e5\u671f\u51fd\u6570getDate()\u3002
22. \u4e3a\u4e86\u52a0\u5feb\u5bf9\u67d0\u8868\u67e5\u8be2\u7684\u901f\u5ea6\uff0c\u5e94\u5bf9\u6b64\u8868\u5efa\u7acb\uff08\uff09\u3002\uff08\u9009\u62e9\u4e00\u9879\uff09D
A. \u7ea6\u675f
B. \u5b58\u50a8\u8fc7\u7a0b
C. \u89c4\u5219
D. \u7d22\u5f15
23. \u5047\u8bbe\u6709\u8868student\uff08\u5b66\u751f\uff09\u7684\u8bbe\u8ba1\u5982\u4e0b\uff1a
id () \u6807\u8bc6\u5217
name () \u5b66\u751f\u59d3\u540d
address () \u5b66\u751f\u5730\u5740
department () \u6240\u5c5e\u9662\u7cfb
departmentHead () \u5b66\u9662\u4e3b\u7ba1
\u8be5\u8868\u6700\u9ad8\u6ee1\u8db3()\u8303\u5f0f\u3002\uff08\u9009\u62e9\u4e00\u9879\uff09B
A. \u4e00
B. \u4e8c
C. \u4e09
D. \u4e0d\u6ee1\u8db3\u4efb\u4f55\u8303\u5f0f
24. \u4e3a\u6570\u636e\u5e93\u4e2d\u4e00\u4e2a\u6216\u8005\u591a\u4e2a\u8868\u4e2d\u7684\u6570\u636e\u63d0\u4f9b\u53e6\u5916\u4e00\u79cd\u67e5\u770b\u65b9\u5f0f\u7684\u903b\u8f91\u8868\u88ab\u79f0\u4e3a\uff08\uff09\u3002\uff08\u9009\u62e9\u4e00\u9879\uff09C
A. \u5b58\u50a8\u8fc7\u7a0b
B. \u6570\u636e\u5e93\u5173\u7cfb\u56fe
C. \u89c6\u56fe
D. \u8868
25. \u8981\u5efa\u7acb\u4e00\u4e2a\u6559\u5e08\u8868\uff0c\u5305\u542b\u59d3\u540d\u3001\u804c\u79f0\u3001\u7ea7\u522b\u7b49\u5b57\u6bb5\u3002\u82e5\u63d2\u5165\u6570\u636e\u65f6\uff0c\u7ea7\u522b\u5b57\u6bb5\u5982\u679c\u4e0d\u8f93\u5165\uff0c\u7f3a\u7701\u503c\u4e3a\u201c\u8bb2\u5e08\u201d\uff0c\u6700\u5408\u9002\u7684\u5b9e\u73b0\u65b9\u5f0f\u662f\uff08\uff09\u3002A
A. \u4e3a\u201c\u7ea7\u522b\u201d\u5b57\u6bb5\u5efa\u7acbdefault\u7ea6\u675f\u3002
B. \u4e3a\u201c\u7ea7\u522b\u201d\u5b57\u6bb5\u5efa\u7acbcheck\u7ea6\u675f\u3002
C. \u4e3a\u6559\u5e08\u8868\u6570\u636e\u8f93\u5165\u7f16\u5199\u4e00\u4e2a\u5b58\u50a8\u8fc7\u7a0b\u8fdb\u884c\u63a7\u5236\u3002
26. \u73b0\u6709\u8ba2\u5355\u8868orders,\u5305\u542b\u6570\u636e\u5982\u4e0b\u8868\u3002\u82e5\u67e5\u8be2\u65e2\u8ba2\u8d2d\u4e86\u4ea7\u54c1p01,\u53c8\u8ba2\u8d2d\u4e86\u4ea7\u54c1p02\u7684\u987e\u5ba2\u7f16\u53f7\uff0c\u53ef\u4ee5\u6267\u884c\u4ee5\u4e0b\uff08\uff09sql\u8bed\u53e5\u3002\uff08\u9009\u62e9\u4e24\u9879\uff09CD

A. select distinct (cid) from orders ol where ol.pid in ('p01','p02')
B. select distinct (cid) from orders ol where ol.pid = 'p01' and ol.pid = 'p02'
C. select distinct (o1.cid) from orders o1,orders o2 where o1.pid='p01' and o2.pid='p02' and o2.cid = o1.cid
D. select distinct(cid) from orders where pid = 'p01' and cid in(select cid from orders where pid='p02')
27. \u5173\u4e8e\u805a\u96c6\u7d22\u5f15\uff0c\u4ee5\u4e0b\uff08\uff09\u8bf4\u6cd5\u662f\u9519\u8bef\u7684\u3002\uff08\u9009\u62e9\u4e24\u9879\uff09CD
A. \u4e00\u4e2a\u8868\u6700\u591a\u53ea\u80fd\u521b\u5efa\u4e00\u4e2a\u805a\u96c6\u7d22\u5f15\u3002
B. \u805a\u96c6\u7d22\u5f15\u6bd4\u975e\u805a\u96c6\u7d22\u5f15\u6709\u66f4\u5feb\u7684\u8bbf\u95ee\u901f\u5ea6\u3002
C. \u4e3b\u952e\u4e00\u5b9a\u662f\u805a\u96c6\u7d22\u5f15\u3002
D. \u521b\u5efa\u4e86\u805a\u96c6\u7d22\u5f15\u7684\u5217\u4e0d\u5141\u8bb8\u6709\u91cd\u590d\u503c\u3002
28. \u5173\u4e8e\u89c6\u56fe\uff0c\u4ee5\u4e0b\uff08\uff09\u8bf4\u6cd5\u662f\u9519\u8bef\u7684\u3002\uff08\u9009\u62e9\u4e00\u9879\uff09C
A. \u4f7f\u7528\u89c6\u56fe\uff0c\u53ef\u4ee5\u7b80\u5316\u6570\u636e\u7684\u4f7f\u7528\u3002
B. \u4f7f\u7528\u89c6\u56fe\uff0c\u53ef\u4ee5\u4fdd\u62a4\u654f\u611f\u6570\u636e\u3002
C. \u89c6\u56fe\u662f\u4e00\u79cd\u865a\u62df\u8868\uff0c\u89c6\u56fe\u4e2d\u7684\u6570\u636e\u53ea\u80fd\u6765\u6e90\u4e8e\u7269\u7406\u6570\u636e\u8868\uff0c\u4e0d\u80fd\u6765\u6e90\u4e8e\u5176\u4ed6\u89c6\u56fe\u3002
D. \u89c6\u56fe\u4e2d\u6307\u5b58\u50a8\u4e86\u67e5\u8be2\u8bed\u53e5\uff0c\u5e76\u4e0d\u5305\u542b\u4efb\u4f55\u6570\u636e\u3002
29. \u5e38\u7528\u7684\u5b58\u50a8\u8fc7\u7a0b\u4e0d\u5305\u62ec\uff08\uff09\u3002\uff08\u9009\u62e9\u4e00\u9879\uff09D
A. sp_tables
B. sp_columns
C. sp_stored_procedures
D. sp_renametable
30. \u5bf9\u4e8b\u52a1\u7684\u63cf\u8ff0\u9519\u8bef\u7684\u662f\uff08\uff09\u3002\uff08\u9009\u62e92\u9879\uff09BD
A. \u4e00\u4e2a\u4e8b\u52a1\u4e2d\u7684\u6240\u6709\u547d\u4ee4\u4f5c\u4e3a\u4e00\u4e2a\u6574\u4f53\u63d0\u4ea4\u6216\u8005\u56de\u6eda\u3002
B. \u5982\u679c\u4e24\u4e2a\u5e76\u53d1\u4e8b\u52a1\u8981\u540c\u65f6\u4fee\u6539\u4e00\u4e2a\u8868\uff0c\u53ef\u80fd\u4ea7\u751f\u6b7b\u9501\u3002
C. SQL Server\u9ed8\u8ba4\u5c06\u6bcf\u6761\u5355\u72ec\u7684T-SQL\u8bed\u53e5\u89c6\u4e3a\u4e00\u4e2a\u4e8b\u52a1\u3002
D. \u4e8b\u52a1\u5fc5\u987b\u4f7f\u7528begin transaction\u6765\u660e\u786e\u5236\u5b9a\u4e8b\u52a1\u7684\u5f00\u59cb\u3002
31. \u5206\u6570\u8868scores\u8bbe\u8ba1\u5982\u4e0b\uff1a
courseID(\u8bfe\u7a0b\u7f16\u53f7)
studentID(\u5b66\u751f\u7f16\u53f7)
score(\u5206\u6570)
\u53e6\u6709\u4e00\u4e2a\u5b66\u751f\u4fe1\u606f\u8868student,\u5305\u542bstudentID,sname(\u5b66\u751f\u59d3\u540d)\u3002
\u5df2\u77e5\u5e76\u975e\u6240\u6709\u5b66\u751f\u90fd\u53c2\u52a0\u4e86courseID\u4e3a0001\u7684\u8003\u8bd5\uff0c\u73b0\u5728\u67e5\u8be2\u6240\u6709\u53c2\u52a00001\u53f7\u8bfe\u7a0b\u8003\u8bd5\u53ca\u683c\u5b66\u751f\u7684\u5b66\u751f\u59d3\u540d\uff0c\u4e0b\u9762\u6b63\u786e\u7684\u662f\uff08\uff09\u3002\uff08\u9009\u62e9\u4e00\u9879\uff09A
A. select sname from student where studentID in (select studentID from scores where courseID = 0001 and score>=60)
B. select sname from student where studentID = (select studentID from scores where courseID = 0001 and score>=60)
C. select sname from student where studentID not in (select studentID from scores where courseID = 0001 and score<=60)
D. select sname from student where studentID exists (select studentID from scores where courseID = 0001 and score>=60)
32. \u5728\uff08\uff09\u7684\u5217\u4e0a\u66f4\u9002\u5408\u521b\u5efa\u7d22\u5f15\u3002\uff08\u9009\u62e9\u4e24\u9879\uff09AD
A. \u9700\u8981\u5bf9\u6570\u636e\u8fdb\u884c\u6392\u5e8f
B. \u5177\u6709\u9ed8\u8ba4\u503c
C. \u9891\u7e41\u66f4\u6539
D. \u9891\u7e41\u641c\u7d22
33. SQL Server\u6570\u636e\u5e93\u67092\u79cd\u767b\u5f55\u8ba4\u8bc1\u65b9\u5f0f\u3002\u5176\u4e2d\u5728\uff08\uff09\u65b9\u5f0f\u4e0b\uff0c\u9700\u8981\u5ba2\u6237\u7aef\u5e94\u7528\u7a0b\u5e8f\u8fde\u63a5\u65f6\u63d0\u4f9b\u767b\u5f55\u65f6\u9700\u8981\u7528\u6237\u6807\u8bc6\u548c\u5bc6\u7801\u3002C
A. Windows\u8eab\u4efd\u8ba4\u8bc1\u3002
B. \u4ee5\u8d85\u7ea7\u7528\u6237\u8eab\u4efd\u767b\u5f55\u3002
C. SQL Server\u8eab\u4efd\u8ba4\u8bc1\u3002
D. \u4ee5\u7cfb\u7edf\u8eab\u4efd\u767b\u5f55\u65f6\u3002
34. SQL Server\u6570\u636e\u5e93\u4e2d\uff0c\u4e0b\u5217\u4e0d\u5c5e\u4e8eT-SQL\u4e8b\u52a1\u7ba1\u7406\u8bed\u53e5\u7684\u662f\uff08\uff09\u3002\uff08\u9009\u62e9\u4e00\u9879\uff09B
A. BEGIN TRANSACTION;
B. END TRANSACTION;
C. COMMIT TRANSACTION;
D. ROLLBACK TRANSACTION;
35. \u8981\u5efa\u7acb\u4e00\u4e2a\u7ea6\u675f\uff0c\u4fdd\u8bc1\u7528\u6237\u8868(user)\u4e2d\u5e74\u9f84(age)\u5fc5\u987b\u572816\u5c81\u4ee5\u4e0a\uff0c\u4e0b\u9762\u8bed\u53e5\u6b63\u786e\u7684\u662f\uff08\uff09\u3002\uff08\u9009\u62e9\u4e00\u9879\uff09A
A. alter table user add constraint ck_age CHECK(age>16)
B. alter table user add constraint df_age DEFAULT(16) for age
C. alter table user add constraint uq_age UNIQUE(age>16)
D. alter table user add constraint df_age DEFAULT(16)
36. SQL Server\u6570\u636e\u5e93\u4e2d\uff0c\u5305\u542b\u4e24\u4e2a\u8868\uff1aOrder\u8ba2\u5355\u8868\uff0cItem\u8ba2\u5355\u5b50\u9879\u76ee\u8868\u3002\u5f53\u4e00\u4e2a\u65b0\u8ba2\u5355\u88ab\u52a0\u5165\u65f6\uff0c\u6570\u636e\u8981\u5206\u522b\u4fdd\u5b58\u5230Order\u548cItem\u8868\uff0c\u8981\u4fdd\u8bc1\u6570\u636e\u5b8c\u6574\u6027\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\uff08\uff09\u8bed\u53e5\u3002\uff08\u9009\u62e9\u4e00\u9879\uff09C
A. BEGIN TRASACTION
INSERT INTO Order VALUES(\u6b64\u5904\u7701\u7565)
INSERT INTO Items VALUES(\u6b64\u5904\u7701\u7565)
END TRASACTION
B. BEGIN TRASACTION
INSERT INTO Order VALUES(\u6b64\u5904\u7701\u7565)
INSERT INTO Items VALUES(\u6b64\u5904\u7701\u7565)
IF(@@Erro = 0)
COMMIT TRASACTION
ELSE
ROLLBACK TRASACTION
C. BEGIN TRASACTION
INSERT INTO Order VALUES(\u6b64\u5904\u7701\u7565)
IF(@@Erro = 0)
INSERT INTO Items VALUES(\u6b64\u5904\u7701\u7565)
IF(@@Erro = 0)
COMMIT TRASACTION
ELSE
ROLLBACK TRASACTION
ELSE
ROLLBACK TRASACTION
D. BEGIN TRASACTION
INSERT INTO Order VALUES(\u6b64\u5904\u7701\u7565)
INSERT INTO Items VALUES(\u6b64\u5904\u7701\u7565)
IF(@@Erro 0)
ROLLBACK TRASACTION
37. \u73b0\u6709\u4e00\u4e2a\u5b66\u751f\u4fe1\u606f\u8868student\uff0c\u5305\u542b\u4e3b\u952estudentID\uff08\u5b66\u751f\u7f16\u53f7\uff09\u3002\u53c8\u6709\u5206\u6570\u8868scores\uff0c\u5305\u542bstudentID\uff08\u5b66\u751f\u7f16\u53f7\uff09\u3001\u4ee5\u53cascore\uff08\u8003\u8bd5\u5206\u6570\uff09\u3002\u5df2\u77e5student\u8868\u4e2d\u5171\u670950\u4e2a\u5b66\u751f\uff0c\u670945\u4eba\u53c2\u52a0\u4e86\u8003\u8bd5\uff08\u5206\u6570\u5b58\u5728scores\u8868\u4e2d\uff09\uff0c\u5176\u4e2d10\u4eba\u4e0d\u53ca\u683c\u3002\u6267\u884c\u4ee5\u4e0bSQL\u8bed\u53e5\uff1a
select * from student where exists(select studentId form score where score<60)
\u53ef\u8fd4\u56de\uff08\uff09\u6761\u8bb0\u5f55\u3002\uff08\u9009\u62e9\u4e00\u9879\uff09A
A. 50
B. 45
C. 10
D. 0
38. create table student
(
id int identity(1,1),
name varchar(20)
)
alter table student add constraint uq_name unique(name)
insert into student values(null)
insert into student values(null)
insert into student values('jack')
insert into student values('jack')
\u4f9d\u6b21\u6267\u884c\u4ee5\u4e0aSQL\u8bed\u53e5\u540e\uff0cstudent\u8868\u4e2d\u5b58\u5728\uff08\uff09\u884c\u8bb0\u5f55\u3002B
A. 1
B. 2
C. 3
D. 4
39. \u5df2\u77e5employee\u8868\u4e2d\u5177\u6709\u9ed8\u8ba4\u7ea6\u675fdf_email\uff0c\u5220\u9664\u8be5\u7ea6\u675f\u7684\u8bed\u53e5\u4e3a\uff08\uff09\u3002\uff08\u9009\u62e9\u4e00\u9879\uff09A
A. alter talbe employee drop constraint df_email
B. alter talbe employee remove constraint df_email
C. alter talbe employee delete constraint df_email
D. remove constraint df_email from talbe employee
40. \u5728employee\u8868\u7684firstname\u5b57\u6bb5\u4e0a\u5efa\u7acb\u7684\u975e\u805a\u96c6\u7d22\u5f15\u7684\u7269\u7406\u6548\u679c\u662f\uff08\uff09\u3002\uff08\u9009\u62e9\u4e00\u9879\uff09D
A. \u6240\u6709\u7684\u884c\u6309\u7167firstname\u5b57\u6bb5\u503c\u5347\u5e8f\u6392\u5217\u5e76\u7269\u7406\u5730\u5b58\u50a8\u5728\u6570\u636e\u9875\u4e2d
B. \u7d22\u5f15\u4e2d\u7684\u9879\u6309\u7167\u7d22\u5f15\u952e\u503c\u7684\u987a\u5e8f\u5b58\u50a8\uff0c\u4f46\u8868\u4e2d\u4fe1\u606f\u7684\u987a\u5e8f\u4fdd\u6301\u4e0d\u53d8\u3002
C. \u6240\u6709\u7684\u884c\u6309\u7167firstname\u5b57\u6bb5\u503c\u964d\u5e8f\u6392\u5217\u5e76\u7269\u7406\u5730\u5b58\u50a8\u5728\u6570\u636e\u9875\u4e2d
D. \u6240\u6709\u7684\u884c\u88ab\u7269\u7406\u5730\u5b58\u50a8\u5728\u6570\u636e\u9875\u4e0a\uff0c\u5e76\u4e14\u6839\u636efirstname\u5b57\u6bb5\u6309\u7167\u7d22\u5f15\u5efa\u7acb\u65f6\u6307\u5b9a\u7684\u987a\u5e8f\u6392\u5217
41. \u521b\u5efa\u5b58\u50a8\u8fc7\u7a0b\u7684\u7247\u65ad\u5982\u4e0b\uff1a\u521b\u5efa\u6210\u529f\u540e\uff0c\u4ee5\u4e0b\uff08\uff09\u8c03\u7528\u65b9\u5f0f\u662f\u6b63\u786e\u7684\u3002\uff08\u9009\u62e9\u4e00\u9879\uff09B
create procedure proc_score
@passed int = 60,
@count int output
as
select count(*) from scores where score < @passed
A. execute proc_score @count int output
B. declare @count int
execute proc_score 70,@count output
C. declare @count int output
execute proc_score 70,@count
D. execute proc_score 70,@count output
42. \u73b0\u6709\u5b66\u751f\u8868Students\u548c\u7528\u6237\u8868Users\uff0c\u4e24\u8868\u4e2d\u7684\u6570\u636e\u5982\u4e0b\uff1a
\u6267\u884csql\u8bed\u53e5\uff1aselect * from Users union select * from Students\u3002\u4e0b\u5217\u8bf4\u6cd5\u6b63\u786e\u7684\u662f\uff08\uff09\u3002\uff08\u9009\u62e9\u4e00\u9879\uff09A
Users Students
userID\uff08int\uff09 name (varchar) studentID(int) age(int)
1 Wen 1 80
2 Shu 2 75
3 Gao
4 Shui
A. \u51fa\u73b0\u9519\u8bef\uff1aname\u4e0eage\u4e0d\u662f\u540c\u4e00\u6570\u636e\u7c7b\u578b\u3002
B. \u6b63\u786e\u6267\u884c\uff0c\u8fd4\u56de6\u884c4 \u5217\u3002
C. \u6b63\u786e\u6267\u884c\uff0c\u8fd4\u56de6\u884c2 \u5217\u3002
D. \u6b63\u786e\u6267\u884c\uff0c\u8fd4\u56de4\u884c2\u5217\u3002
43. \u5047\u8bbe\u6709scores\u8868\u7684\u8bbe\u8ba1\u5982\u4e0b\uff1a
ID\uff08\u7f16\u53f7\uff0c\u4e3b\u952e\uff09
StudentID\uff08\u5b66\u751f\u7f16\u53f7\uff09
CourseID\uff08\u8bfe\u7a0b\u7f16\u53f7\uff09
Score\uff08\u5206\u6570\uff09
\u73b0\u5728\u8981\u67e5\u8be2\u53c2\u52a0\u8fc7\u81f3\u5c11\u4e24\u95e8\u8bfe\u7a0b\u8003\u8bd5\u7684\u5b66\u751f\u5404\u95e8\u8bfe\u7a0b\u7684\u5e73\u5747\u6210\u7ee9\u3002\u4ee5\u4e0bSQL\u8bed\u53e5\u6b63\u786e\u7684\u662f\uff08\uff09\u3002\uff08\u9009\u62e9\u4e00\u9879\uff09A
A. select StudentID,avg(score) from scores group by StudentID having count(studentID)>1
B. select StudentID,avg(score) from scores group by StudentID where count(studentID)>1
C. select StudentID,avg(score) from scores group by StudentID where count(studentID)>1 group by StudentID
D. select StudentID,avg(score) from scores having count(studentID)>1
44. \u5047\u8bbeorders\u8868\u4e2d\u5b58\u5728orderid\u7b49\u4e8e1\u7684\u7eaa\u5f55\uff0c\u6267\u884c\u4e0b\u9762T-SQL\uff1a
begin transaction
delete from orders where orderid = 1
if (@@error0)
rollback transaction
rollback transaction
\u4ee5\u4e0b\u8bf4\u6cd5\u6b63\u786e\u7684\u662f\uff08\uff09\u3002\uff08\u9009\u62e9\u4e00\u9879\uff09B
A. \u6267\u884c\u6210\u529f\uff0corderid\u4e3a1\u7684\u8bb0\u5f55\u88ab\u6c38\u4e45\u5220\u9664\u3002
B. \u6267\u884c\u6210\u529f\uff0corders\u8868\u6ca1\u6709\u4efb\u4f55\u53d8\u5316\u3002
C. \u6267\u884c\u65f6\u51fa\u73b0\u9519\u8bef\u3002
D. \u6267\u884c\u6210\u529f\uff0c\u4f46\u4e8b\u52a1\u5904\u7406\u5e76\u6ca1\u6709\u7ed3\u675f\u3002
45. \u9879\u76ee\u5f00\u53d1\u9700\u8981\u7ecf\u8fc7\u51e0\u4e2a\u9636\u6bb5\uff0c\u7ed8\u5236\u6570\u636e\u5e93\u7684E-R\u56fe\u5e94\u8be5\u5728\uff08\uff09\u9636\u6bb5\u8fdb\u884c\u3002\uff08\u9009\u62e9\u4e00\u9879\uff09B
A. \u9700\u6c42\u5206\u6790
B. \u6982\u8981\u8bbe\u8ba1
C. \u8be6\u7ec6\u8bbe\u8ba1
D. \u4ee3\u7801\u7f16\u5199
46. \u5c06E-R\u56fe\u8f6c\u6362\u4e3a\u8868\u7684\u8fc7\u7a0b\u4e2d\uff0c\u5982\u679c\u5b9e\u4f53\u4e4b\u95f4\u5b58\u5728\u591a\u5bf9\u591a\u7684\u5173\u7cfb\uff0c\u901a\u5e38\u7684\u505a\u6cd5\u662f\uff08\uff09\u3002\uff08\u9009\u62e9\u4e00\u9879\uff09B
A. \u5728\u4e24\u4e2a\u5b9e\u4f53\u95f4\u5efa\u7acb\u4e3b\u5916\u952e\u5173\u7cfb\u3002
B. \u5728\u4e24\u4e2a\u5b9e\u4f53\u95f4\u5efa\u7acb\u5173\u8054\u8868\uff0c\u628a\u4e00\u4e2a\u591a\u5bf9\u591a\u7684\u5173\u7cfb\u5206\u89e3\u6210\u4e24\u4e2a\u4e00\u5bf9\u591a\u7684\u5173\u7cfb\u3002
C. \u5728\u4e24\u4e2a\u5b9e\u4f53\u95f4\u5efa\u7acb\u5173\u8054\u8868\uff0c\u628a\u4e00\u4e2a\u591a\u5bf9\u591a\u7684\u5173\u7cfb\u5206\u89e3\u6210\u4e24\u4e2a\u4e00\u5bf9\u4e00\u7684\u5173\u7cfb\u3002
D. \u5728\u4e24\u4e2a\u5b9e\u4f53\u95f4\u4e0d\u5efa\u7acb\u4efb\u4f55\u5173\u7cfb\u3002
47. \u67d0\u4e2a\u5b57\u6bb5\u5e0c\u671b\u5b58\u653e\u7535\u8bdd\u53f7\u7801\uff0c\u8be5\u5b57\u6bb5\u5e94\u9009\u7528\uff08\uff09\u6570\u636e\u7c7b\u578b\u3002
A. char(10)
B. text
C. varchar(13)
D. int
48. \u8fd0\u884c\u4ee5\u4e0b\u8bed\u53e5\u5f97\u5230\u7684\u7ed3\u679c\u662f\uff08\uff09C
use javaWebDB
create table numbers
(
N1 INT,
N2 NUMERIC(5,0),
N3 NUMERIC(4,2),
)
INSERT numbers VALUES(100,100.5,10.5)
select * from numbers
A. \u8fd4\u56de100\uff0c100\uff0c10.5\u7684\u7ed3\u679c\u96c6
B. \u8fd4\u56de100\uff0c100\uff0c10.50\u7684\u7ed3\u679c\u96c6
C. \u8fd4\u56de100\uff0c101\uff0c10.50\u7684\u7ed3\u679c\u96c6
D. \u8bed\u53e5\u65e0\u6cd5\u5168\u90e8\u6210\u529f\u6267\u884c
49. \u6570\u636e\u5e93\u4e8b\u52a1\u5904\u7406\u5177\u6709\u5982\u4e0b\u7279\u5f81\uff08\uff09\uff0c\u88ab\u7b80\u79f0\u4e3aACID\u3002\uff08\u9009\u62e9\u56db\u9879\uff09ACEF
A. \u539f\u5b50\u6027
B. \u5b89\u5168\u6027
C. \u9694\u79bb\u6027
D. \u5b8c\u6574\u6027
E. \u6301\u4e45\u6027
F. \u4e00\u81f4\u6027
50. SQL\u8bed\u8a00\u96c6\u6570\u636e\u67e5\u8be2\u3001\u6570\u636e\u64cd\u7eb5\u3001\u6570\u636e\u5b9a\u4e49\u548c\u6570\u636e\u63a7\u5236\u529f\u80fd\u4e8e\u4e00\u4f53\uff0c\u5176\u4e2d\uff0cCREATE\u3001DROP\u3001ALTER\u8bed\u53e5\u662f\u5b9e\u73b0\u54ea\u79cd\u529f\u80fd\uff08 \uff09\u3002C
A. \u6570\u636e\u67e5\u8be2
B. \u6570\u636e\u64cd\u7eb5
C. \u6570\u636e\u5b9a\u4e49
D. \u6570\u636e\u63a7\u5236

某外企SQL Server面试题【2006-04-19 16:09】【IT 专家网】【IT 专家网社区】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高级程序员的试题。

扩展阅读:xboxone欧版 ... sql server express ... xbox series x ... sql server 2019 ... sql server 2008r2 ... microsoft games ... microsoft sql server ... sw不支持的sql server版本 ... server2008r2永久密钥 ...

本站交流只代表网友个人观点,与本站立场无关
欢迎反馈与建议,请联系电邮
2024© 车视网