学历改变命运
24小时客服:4008135555/010-82335555
当前位置:首页> 理学 > 北大数据库及其应用上机题(03年1月14日)

北大数据库及其应用上机题(03年1月14日)

2006年06月09日    来源: 北京自考热线   字体:   打印
准考证

  学生(学号,姓名,性别,出生日期,系号)

  课程(课号,课程名,学分)

  选修(学号,课号,成绩)

  1.建库

  2.输数

  3.编写一个课程信息的录入程序,要求在录入一门课程后屏幕询问:“继续录入吗?”根据用户回答决定程序流程,要求不退出本程序能继续进行录入操作。

  4.用Foxpro语言或sql语言编写程序完成以下查询:

  (1)列出学生名单,要包含所有学生的所有信息,且在更后一行显示“年龄小于18岁的男生有XX人”

  (2)列出成绩不及格的学生的信息,要包含选修表的所有属性,且在更后一行显示“他们的平均成绩为XX分”

  (3)统计数学系每个学生姓名,性别,年龄以及该学生所学课程的总成绩并列表显示。

  (4)检索选课在2门及2门以上的学生的学号,姓名,总学分和平均成绩,并列表显示。(不及格的课程不统计在内)

close all
clear
select 1
use kc
dimension a(3)
action = .t.
answer = .t.
define window w1 from 1,2 to 30 ,60 system close float grow
define window w2 in window w1 from 1,2 to 30 ,50 system close float grow
do while action
   do while .t.
   scatter to a blank
   activate window w1
   clear
   @1,2 say "课号:" get a(1) picture "xxxxxxxxxx"
   @3,2 say "课程名:" get a(2) picture "xxxxxxxxxx"
   @5,2 say "学分:" get a(3) picture "999999"
   read
   activate window w2
   clear
   @ 1,2 say "输入正确么?[y/n]" get answer picture "l"
   read
   deactivate window w2
   if answer
      append blank 
      gather from a
      exit
    endif
  enddo
  clear
  @1,2 say "要继续么?[y/n" get action picture "l"
  read
  deactivate window w1,w1
  enddo
  return  
    
      
close all
clear
select 1
use xs
select 2
use kc
select 3
use xx
select a.xh ,a.xm ,a.xb ,a.csrq  ,b.kh , b.kcm ,b.xf , c.cj ;
from xs a , kc b , xx c to screen;
where (a.xh = c.xh) and (c.kh = b.kh)
select 1
count  for ((year(date()) )- year(csrq) < 18 ) and (xb = "man") to a
? a

close all
clear
select 1
use xs
select 2
use kc
select 3
use xx
select a.xh ,a.xm ,a.xb ,a.csrq ,a.xh , b.kh , b.kcm , c.cj;
from xs a, kc b, xx c to screen;
where (a.xh = c.xh ) and (c.kh = b.kh) and (c.cj < 60)
set talk off
average  for cj<60 to ab
c= "他们的平均成绩"
d= "分"
set talk on
? c
?? ab
?? d

close all
set talk off
clear 
sele 1
use xs
sele 2
use xx
sele 3
use 43
zap
sele 1
do while not eof()
   sele 2
   sum cj for xh = a.xh to a
   sele 3
   append blank
   replace  xm with a.xm , xb with a.xb , nl with  year(date()) - year(a.csrq) ,zcj with a
   sele 1
   skip
 enddo
 set talk on
 sele 3
 list

 

新人有礼
关闭