问题 单项选择题

用SQL语言检索商品种类大于等于2的部门名称及部门的商品数目,并按商品种类的数目降序排序,正确的命令是()

A. SELECTCOUNT(商品.商品号)As商品数目,部门名称;

FROM部门,商品;

WHERE部门.部门号:商品.部门号;

GROUPBY部门名称;

HAVING商品数目>22;

ORDERBY商品数目DESC

B. SELECTCOUNT(商品.商品号)As商品数目,部门名称;

FROM部门,商品;

GROUPBY部门名称;

HAVING商品数目>=2And部门.部门号=商品。部门号;

0RDER BY商品数目DESC

C.SELECTCOUNT(商品.商品号)As商品数目,部门名称;

FROM部门,商品;

GROUPBY部门名称;

WHERE商品数目>=2;

ORDERBY商品数目DESC

D.SELECTCOUNT(商品.商品号)As商品数目,部门名称;

FROM部门,商品;

WHERE部门.部门号:商品.部门号And商品数目>:2;

GROUPBY部门名称;

ORDERBY商品数目DESC

答案

参考答案:A

解析:

SQL的数据查询功能:聚集查询 .

[评析] VisualFoxPro的SELECT-SQL命令的一般语法格式如下:

SELECT[ALL|DIST|NCT]<目标列表达式>[,<目标列表达式>]…

FROM<基本表(或视图)[,<基本表(或视图)>]…

[WHERE<条件表达式>]

[GROUPBY<列名1>[HAVING<内部函数表达式>]]

[ORDER BY<列名2>[ASC|DESC]]

说明:

①SELECT子句:ALL表示选出的记录中包括重复记录,这是缺省值;DISTINCT则表示选出的记录中不包括重复记录。

②FROM子句及其选项:用于指定查询的表,可以对单个表或多个表进行查询。

③WHERE子句:说明查询条件,即筛选元组的条件。

④GROUPBY子句:对记录按<列名1>值分组,常用于分组统计。

⑤HAVING子句:当含有GROUPBY子句时,HAVING子句可用作记录查询的限制条件;无GROUPBY子句时HAVING子句的作用如同WHERE子句。

⑥ORDERBY子句:指定查询结果中记录按<列名2>排序,默认升序。选项ASC表示升序,DESC表示降序。在本题中,首先要查出各个部门的商品的种类,就要以部门名称对商品号进行COUNT聚集查询。然后根据聚集查询的结果用HAVING子句进行筛选,最后利用ORDERB.Y子句进行排序。在查询语句中,WHERE子句用来实现两个表的连接。

完形填空

I have a brother.He is __1___me. We were born in the same year.We__2__16.Yesterday was an important day__3___friends. In the morning,_4____of us had a big test at the technical collage and then __5___there was a big meeting at the youth club at nine o’clock.That is where we usually go when we want to___6__ourselves.A rich woman donated some money to our club yesterday ,so we had to decide what to __7__.Many of us wanted to buy something new for our club ,but my brother and I didn’t __8__them.We wanted to give the money to another club that has __9__.In the end ,we decided to give half to the poor club and __10__half for ourselves .We are very happy to do this.

小题1:A so old as    B so old than     C the same than  D  as old as

小题2:A both are     B are both        C are all       D  all are

小题3:A to us and our B with us and our  C to us and ours D for us and ours

小题4:A most          B much            C  more         D few

小题5:A last night   B last Monday     C tomorrow      D yesterday afternoon

小题6:A enjoy        B meet            C like          D play with

小题7:A do with them  B  do with it     C use it        D use them

小题8:A agree with    B agree to        C agree on      D agree

小题9:A something    B  anything       C nothing       D everything

小题10:A keep another B keep the other  C hold another   D keep the another

名词解释