编程要求
student表数据结构:
stu_id | name | math | chinese |
---|
1 | Tom | 80 | 78 |
2 | Jack | 70 | 80 |
3 | Lucy | 97 | 95 |
stu_info表数据结构:
stu_id | classes | city |
---|
1 | 1633 | 长沙 |
2 | 1632 | 重庆 |
3 | 1633 | 成都 |
编程任务
在student表上创建视图stu_view,查询math、chinese字段并定义一个math+chinese成绩之和字段,值为两者之和;
在student表和stu_info表上,创建stu_classes视图,查询出stu_id、姓名和班级,查询条件为两表中的stu_id字段相同。
代码实现
![在这里插入图片描述](https://img-blog.csdnimg.cn/1ece5e42a41142949e54b7da7d4d92af.png)
输出结果
![在这里插入图片描述](https://img-blog.csdnimg.cn/2c26d45be78647d7a312689e05efe312.png)