CREATE TABLE Average_Professor
SELECT ie.Instructor
,SUM(ie.instreffective_avg + h.howmuchlearned_avg + ir.instrrespect_avg +
iv.instroverall_avg + av.availability_avg)/5
FROM instreffective_average ie
JOIN howmuchlearned_average h USING (Instructor)
JOIN instrrespect_average ir USING (Instructor)
JOIN instructoroverall_average iv USING (Instructor)
JOIN availability_average av USING (Instructor)
GROUP BY Instructor
它给了我错误代码1166.如果我省略“CREATE TABLE Professor_average”然后脚本运行,但我没有创建表。
答案 0 :(得分:1)
尝试命名计算列:
CREATE TABLE Average_Professor
SELECT ie.Instructor
,SUM(ie.instreffective_avg + h.howmuchlearned_avg + ir.instrrespect_avg +
iv.instroverall_avg + av.availability_avg)/5 as calculation_value
FROM instreffective_average ie
JOIN howmuchlearned_average h USING (Instructor)
JOIN instrrespect_average ir USING (Instructor)
JOIN instructoroverall_average iv USING (Instructor)
JOIN availability_average av USING (Instructor)
GROUP BY Instructor