我在Postgresql上遇到SQL查询问题.这个select子句是数据库讲座的一个例子:
1 select t.CourseNr, t.StudentsPerCourse, g.StudentCount, 
2        t.StudentsPerCourse/g.StudentCount as Marketshare
3 from (select CourseNr, count(*) as StudentsPerCourse
4       from taking
5       group by CourseNr) t,
6      (select count(*) as StudentCount
7       from Students) g;
问题是第2行中的Marketshare列.LearningPerCourse和StudentCount都是整数类型.
在我的Postgresql数据库上使用它时,Marketshare列被评估为int类型,而我需要一个float/numeric.我没有找到任何方法来通过在SELECT子句上搜索Postgresql文档或通过googling来指定数据类型.是否有(最好是标准的SQL)方式来指定列类型或我在这里遗漏了什么?