问题 单项选择题

(31)到(35)题使用如下数据表。
部门(部门号C(2)、部门名称C(10) )
职工(部门号C(2)、职工号C(4)、姓名C(8)、基本工资N(7,2) )

检索最少有5名职工的每个部门的职工基本工资的总额,正确的语句是( )。

A.SELECT部门号,COUNT(*),SUM(基本工资)FROM职工; HAVING COUNT(*)>=5

B.SELECT部门号,COUNT(*),SUM(基本工资)FROM职工; GROUP BY基本工资HAVING COUNT(*)>=5

C.SELECT部门号,COUNT(*),SUM(基本工资)FROM职工; GROUP BY部门号HAVING COUNT(*)>=5

D.SELECT部门号,COUNT(*),SUM(基本工资)FROM职工; GROUP BY部门号WHERE COUNT(*)>=5

答案

参考答案:C

解析: 在分组与计算查询语句中,使用HAVING子句可以对分组进一步加以控制。用这个子句定义这些组所必须满足的条件,以便将其包含在结果中,HAVING子句必须与GROUP BY短语同时使用。 本题中先由GROUP BY子句按“部门号”对记录行进行分组:再执行COUNT()函数统计每组中有多少个记录,执行SUM()函数计算每个组的基本工资总和:最后执行HAVING子句,只有记录总数大于等于5的组才输出结果,即部门职工在5名(含)以上的。注意:此时输出的组记录是计算后的记录,即每组只包含一条记录,输出信息包括该部门的部门号、总人数和职工工资总和。

阅读理解

阅读理解。

     A few days ago my wife sent me out to buy something. When I came home, I handed her a paper bag

and said, "Here are the apples you wanted." She looked in the bag, and then she looked at me. "I told you,"

she said slowly, "to buy some eggs."

     I felt worried about my absent-mindedness, so I went to see a doctor. He was a very kind man "I have

seen many people like you. It's nothing to worry about," he said "If you know you are absent-minded, you

are all right.But if you do not know you're absent-minded, you may be really in trouble."

     "Many famous people were absent-minded," the doctor told me. "Thomas Edison was standing in line

one day to pay his taxes. When he arrived at the window, he found that he had forgotten his own name.

He had to ask the man who was behind him to tell him who he was."

     I felt much better and got up to leave. "Thank you, doctor," I said. "How much do I have to pay you?"

     "Ten dollars for the check-up," the doctor said.

     "But doctor, I did not have a check-up!"

     For a moment the doctor looked puzzled. Then he said, "Oh, yes, it was the patient before you who had

a check-up. How absent-minded I am!"

1. The doctor took Edison's story for example ____.

A. to show absent-mindedness is common among people

B. because he liked telling stories

C. to make the author laugh

D. to make fun of Edison

2. The underlined word "absent-mindedness" in the second paragraph probably means ____.

A. a feeling of anger

B. a feeling of sadness

C. an emotion (情绪) of excitement

D. a trouble in which people often forget this or that

3. According to the passage, who was absent-minded?

A. Only the author.

B. The author's wife.

C. The doctor alone.

D. The author and the doctor.

多项选择题