Home > database >  The SQL query problem
The SQL query problem

Time:10-09

Student achievement score table, the curriculum course
1, the query all need make-up examination (<60 points) and the name of the student's name and the course of achievement
2, query each student need to make-up examination (<60 points) course score and the average order

CodePudding user response:

1. Select s.s c_name, Arthur c. o_name, s.s core
The from score s,
Course c
Where s.s c_courseid=Arthur c. o_id
And s.s core<60
2. Select s.s c_name, avg (s, sc. Score)
The from score s
Where s.s core<60
Group by s.s c_name
The order by avg (s, sc. Score)

CodePudding user response:

1.
SELECT
SC_NAME, student's name
, CO_NAME - course
, SC_SCORE -
The FROM SCORE T1
INNER JOIN COURSE T2
ON T1. SCOURSEID=T1. CO_ID
WHERE a T1. SC_SCORE & lt; 60
;
2.
SELECT
T1. SC_NAME
, AVG (T1 SC_SCORE)
The FROM SCORE T1
WHERE a T1. SC_SCORE & lt; 60
GROUP BY T1. SC_NAME SC_COURSEID
The ORDER BY AVG (T1) SC_SCORE)
;

CodePudding user response:

1. Select s.s c_name, Arthur c. o_name, s.s c_score
The from score s
Inner join course c on s.s c_courseid=Arthur c. o_id
Where s.s c_score & lt; 60
2. Select s.s c_name, avg (s.s c_score)
The from score s
Where s.s c_score & lt; 60
Group by s.s c_name
The order by avg (s.s c_score)
  • Related