34.已知考试成绩数据库文件grade.dbf,其字段有:number(序号,字符型),name(姓名,字符型),age(年龄,数值型),math(数字,数值型),english(英语,数值型),pass(通过,逻辑型)。现要求将数学和英语成绩均不低于60分的记录的pass字段值置为真。请完成下述程序。 SET TALK OFF USE grade REPLACE pass WITH (1) FOR (2) ALL LIST FOR (3) TO (4) USE SET TALK ON RETURN (1) (2) (3) (4) 35.已知数据库文件 product.dbf,其字段有pno(产品编号,字符型),pname(产品名,字符型),amount(数量,数值型),price(价格,数值型),parea(产地,字符型)。现要求列出产地为“四川”的产品的数量,以及产品数量最多的产地。请完成下述程序: SET TALK OFF CLEAR SELECT SUM(amount), parea FROM (1) ; WHERE parea="四川"; ORDER BY amount DESC SELECT product INDEX ON (2) TO pindx TOTAL ON (3) TO ptot d=SPACE(20) SELECT 2 USE ptot max1=amount DO WHILE.NOT.EOF( ) IF (4) THEN max1=amount d=parea ENDIF SKIP ENDDO ?"产地:",d,"最大数量",max1 CLOSE ALL SET TALK ON RETURN (1) (2) (3) (4) 36.已知学生数据库文件stud.dbf,其字段有sno(学号,数值型),sname(姓名,字符型)。现抽取学号能被3整除的学生参加数学建模比赛,要求显示被抽到的学生的学号和姓名。请完成下述程序。 SET TALK OFF USE stud COPY STRUCTURE TO stud1 FIELDS sno, sname SELECT 2 USE stud1 APPEND BLANK SELECT 1 DO WHILE (1) IF (2) THEN SELECT 2 REPLACE sno WITH A->sno, sname WITH A->sname (3) ENDIF SELECT 1 (4) ENDDO SELECT 2 LIST CLOSE ALL SET TALK ON RETURN (1) (2) (3) (4) 37.数据库文件study.dbf的字段有:sname(学生名,字符型),cno(课程号,字符型),grade(分数,数值型)。数据库文件course.dbf的字段有:cname(课程名,字符型),cno(课程号,字符型),credit(学分,数值型)。下述程序的功能是查找只有一个学生学过的课程信息。请完成下述程序。 SET TALK OFF (1) SELECT B USE course SELECT A USE study JOIN WITH course TO new FIELDS cno, course->cname, course->credit, sname; FOR (2) USE new INDEX ON cno TO new DO WHILE (3) SCATTER TO ary COUNT TO num WHILE (4) IF num=1 THEN ? ary(1), ary(2), ary(3) ENDIF ENDDO CLEAR ALL RETURN (1) (2) (3) (4) |