数据库方面的一个笔试题

huangjcjava 2009-02-11 07:36:36
List表:
A B C
3 7 9
4 8 4
5 6 9

1.选出A,B字段值,并按B的升序排列

2.插入一条记录(7,9,8)

3.选出C值,并按的C降序排列,并消除重复值

写出三条标准的SQL语句实现上面的功能
...全文
125 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
ws_hgo 2009-02-12
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 fcuandy 的回复:]
这个答不出,就不要去面试了
[/Quote]
你去学校读2年再去
找工作把
totsheng 2009-02-12
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 fcuandy 的回复:]
这个答不出,就不要去面试了
[/Quote]
呵呵
  
select a,b from #list order by b

insert into list values ('7','9','8')

select distinct(c) from #list order by c desc

liu_ying_shan 2009-02-12
  • 打赏
  • 举报
回复
1.select a,b from list order by b asc
2.insert into list
values (7,9,8)
3.select distinct c from list order by c desc
y_dong119 2009-02-12
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 rucypli 的回复:]
引用 1 楼 fcuandy 的回复:
这个答不出,就不要去面试了

面试前一定要做好功课
[/Quote]


呵呵,兄弟混饭吃。。。你还是要用点心赛
you_tube 2009-02-12
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 y_dong119 的回复:]
引用 6 楼 rucypli 的回复:
引用 1 楼 fcuandy 的回复:
这个答不出,就不要去面试了

面试前一定要做好功课



呵呵,兄弟混饭吃。。。你还是要用点心赛
[/Quote]

山寨版面试??
Rotel-刘志东 2009-02-12
  • 打赏
  • 举报
回复

上边有写错内容
select A,B from list where B order by asc
insert into list(a,b,c) values(7,8,9)
select distinct (c) from list where c order by c desc
Rotel-刘志东 2009-02-12
  • 打赏
  • 举报
回复
select A,B from list where B order by asc
insert into list(a,b,c) values(7,8,9)
select distinct (c) from list where c order b
lzfrab 2009-02-12
  • 打赏
  • 举报
回复
不是吧,有如此之面试题?呵呵,强
ggsysy 2009-02-12
  • 打赏
  • 举报
回复
还好我会。。呵呵
jianglai11 2009-02-12
  • 打赏
  • 举报
回复
.....这问题,都不好意思回答
ks_reny 2009-02-12
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 fcuandy 的回复:]
这个答不出,就不要去面试了
[/Quote]
現在的人呀,遇到問題都不思考,直接就問別人.唉.
rucypli 2009-02-11
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 fcuandy 的回复:]
这个答不出,就不要去面试了
[/Quote]
面试前一定要做好功课
Terry717 2009-02-11
  • 打赏
  • 举报
回复

--1. 选出A,B字段值,并按B的升序排列
select a,b from list order by b asc -- order by 默认排序为asc, 如为升序,可以不写asc

--2. 插入一条记录(7,9,8)
insert list select 7,9,8

--3.选出C值,并按的C降序排列,并消除重复值
select distinct c from list order by c desc


像这样的查询是基本的操作,建议楼主有空把基础多加强加强,多动手操作
水族杰纶 2009-02-11
  • 打赏
  • 举报
回复
if object_id('list')is not null drop table list
go
create table List(A int, B int,C int)
insert list select 3 , 7, 9
insert list select 4 , 8 , 4
insert list select 5, 6 , 9
--1
select a,b from list order by b asc
--2
insert list select 7,9,8
--3
select distinct c from list order by c desc
/*a b
----------- -----------
5 6
3 7
4 8

c
-----------
9
8
4*/
dawugui 2009-02-11
  • 打赏
  • 举报
回复
[Quote=引用楼主 huangjcjava 的帖子:]
List表:
A B C
3 7 9
4 8 4
5 6 9

1.选出A,B字段值,并按B的升序排列

2.插入一条记录(7,9,8)

3.选出C值,并按的C降序排列,并消除重复值

写出三条标准的SQL语句实现上面的功能
[/Quote]
1.
select a , b from list order by b

2.
insert into list(a,b,c) values(7,9,8)

3.
select c from list order by c desc
水族杰纶 2009-02-11
  • 打赏
  • 举报
回复
--1
select a,b from list order by b asc
--2
insert list select 7,9,8
--3
select distinct c from list order by c desc
fcuandy 2009-02-11
  • 打赏
  • 举报
回复
这个答不出,就不要去面试了

34,590

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧