这个查询有什么问题:
SELECT count() as total_students
FROM student_information;
SELECT
(
SELECT student_project_marks
from students_project
WHERE student_project_id=student_information.student_project_id
)
+ student_assignment_marks
+ student_exam_marks AS total_marks
FROM student_information
ORDER BY total_marks DESC;
UPDATE student_information
SET (
SELECT student_grade
FROM student_information
LIMIT 0.1*total_students
ORDER BY total_marks DESC
)="A";
我正在尝试按获得的总分来选择0.1*total_students
学生人数并更新他们的成绩......前 10% 将被授予 A。我收到错误:
syntax error near '('
我有 2 个表:通过以下查询创建它们:
create table if not exists student_information (
student_name varchar(80),
student_roll_num int primary key,
student_email varchar(64),
student_assignment_marks int(2) check(student_assignment_marks<=30),
student_exam_marks int(2) check(student_exam_marks<=50),
student_project_id varchar(25),
student_grade varchar(2)
)
create table if not exist students_project (
student_project_id varchar(25),
student_project_title varchar(25),
student_project_marks int(2) check(student_project_marks>=0 and student_project_marks<=20)
)
项目中的标记可student_project
通过student_project_id
.
现在我如何根据总分来评分......前10%必须获得A,接下来的10%必须获得B等等......我知道如何计算总分......我写了一个类似的查询这个:
select student_roll_num,
(SELECT student_project_marks
from students_project
WHERE student_project_id=student_information.student_project_id )+
student_assignment_marks+student_exam_marks as total_marks from student_information;
有用。