python第五章自己的笔记总结(5)

第一次

1查询Student表中的所有记录的Sname、Ssex和Class列。

 select studentName,studentSex,studentClass from student;

2以班级降序查询学生表的所有记录。

select * from student order by studentClass desc;

3查询Score表中成绩在60到80之间的所有记录

 `select * from grades where gradesCJ between 60 and 80;`

4查询每门课的平均成绩

 select subjectBH,avg(gradesCJ) as 平均分 from grades group by subjectBH;

5查询课程编号为1的,并且成绩高60 有同学的记录。

 select * from student where studentID in
(select studentID 
from grades
where grades.subjectBH =1  and grades.gradesCJ>60);

6查询"男"教师及其所上的课程。

 select teacher.teacherSex,subject.subjectMC from teacher  join subject where teacher.teacherSex='男' and teacher.teacherBH =subject.teacherBH;

第二次

math模块

import math 

mianji=math.pi*pow(4,2)
#print(mianji)
a=round(mianji,2)
#print(a)
import random

random.random() 随机生成一个浮点数 0-1之间

a=random.random()
#print(a)

“”"

random.randint(start,stop) 随机生成一个start,stop之间的整数
随机生成一个start,stop之间的整数,包括start和stop

“”"

for i in range(10):
    b=random.randint(2,9)
    #print(b)

“”"

random.randrange() 随机生成一个start,stop之间的整数

random.randrange(start,stop,step) 随机生成一个start,stop之间的整数
1.random.randrange(stop) 不写start,默认是0
2.左开右闭
3.step 步长,间隔

“”"

for i in range(20):
    c=random.randrange(1,10) 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值