|

Q: How do I perform specific searches on data, such as: find the students whose grades are in the top 30% of a class?
A: Assume there is a student grade table: student(name char(10),score int); To find out the top 30% of students in the class by using the following commands:
dmSQL> create temp table tt1 (
2> c1 serial(1),
3> name char(10),
4> score int
5> );
dmSQL> select *
2> from student
3> group by score, name
4> into tt1 (name,score);
dmSQL> select name,score
2> from tt1
3> where c1 (
4> select count(c1)*0.7
5> from tt1
6> )
7> order by score desc;
Caution: Every time you execute these commands, you have to rebuild temp table tt1.
|