问题 问答题

【问题5】
假定分别在“职工”关系中的“年龄”和“月工资”字段上创建了索引,如下的 Select查询语句可能不会促使查询优化器使用索引,从而降低查询效率,请写出既可以完成相同功能又可以提高查询效率的SQL语句。
Select 姓名,年龄,月工资 from 职工
where 年龄>45 or 月工资<1000;

答案

参考答案:

Select 姓名,年龄,月工资 From 职工 Where 年龄>45 UNION Select 姓名,年龄,月工资 From 职工 Where 月工资<1000; 因为该SQL语句用了查询嵌套和聚集函数,所以这种方式的查询效率会受到很大的影响。可以把它改成: Select Max(月工资)As maxgz,部门号Into Temp From 职工 Group by 部门号 Select 职工号 From 职工,Temp Where 月工资=maxgz And 职工.部门号=Temp.部门号; 在语句 Select 姓名,年龄。月工资 From 职工 Where 年龄>45 or 月工资<1000; 中,由于使用了条件“Or”,查询的时候变成了对全表的扫描,不会促使查询优化器使用索引,从而降低了查询效率。改正的方法是去掉“Or”,修改后的SQL语句如下: Select 姓名,年龄,月工资 From 职工 Where 年龄>45 UNION Select 姓名,年龄,月工资 From 职工 Where 月工资<1000;

单项选择题

Jan Hendrik Schon’s success seemed too good to be true, and it was. In only four years as a physicist at Bell Laboratories, Schon, 32, had co-authored 90 scientific papers—one every 16 days—detailing new discoveries in superconductivity, lasers, nanotechnology and quantum physics. This output astonished his colleagues, and made them suspicious. When one co-worker noticed that the same table of data appeared in two separate papers—which also happened to appear in the two most prestigious scientific journals in the world, Science and Nature—the jig was up. In October 2002, a Bell Labs investigation found that Schon had falsified and fabricated data. His career as a scientist was finished. Scientific scandals, which are as old as science itself, tend to follow similar patterns of presumption and due reward.

In recent years, of course, the pressure on scientists to publish in the top journals has increased, making the journals much more crucial to career success. The questions are whether Nature and Science have become too powerful as arbiters of what science reaches to the public, and whether the journals are up to their task as gatekeepers.

Each scientific specialty has its own set of journals. Physicists have Physical Review Letters, neuroscientists have Neuron, and so forth. Science and Nature, though, are the only two major journals that cover the gamut of scientific disciplines, from meteorology and zoology to quantum physics and chemistry. As a result, journalists look to them each week for the cream of the crop of new science papers. And scientists look to the journals in part to reach journalists. Why do they care Competition for grants has gotten so fierce that scientists have sought popular renown to gain an edge over their rivals. Publication in specialized journals will win the acclaims from academics and satisfy the publish-or-perish imperative, but Science and Nature come with the added bonus of potentially getting your paper written up in The New York Times and other publications.

Scientists tend to pay more attention to the big two than to other journals. When more scientists know about a particular paper, they’re more apt to cite it in their own papers. Being oft-cited will increase a scientist’s "Impact Factor", a measure of how often papers are cited by peers. Funding agencies use the "Impact Factor" as a rough measure of the influence of scientists they’re considering supporting.

To find why scientific scandals like Schon’s occur, people have begun to raise doubt about the two top journals for ().

A. their academic prestige

B. their importance to career success

C. their popularity with scientific circles

D. their reviewing system

单项选择题