SQL's problem of finding the average of two tables

 t_studentid(id)(name)(sex) (t_score)id(id)id(student_id)id(item_id)(score) sql
Sql
Aug.05,2021

create 2 tables:
student Student Table:
CREATE TABLE student (
id int (11) unsigned NOT NULL AUTO_INCREMENT,
name varchar (255) NOT NULL,
sex tinyint (3) NOT NULL DEFAULT '0mm,
PRIMARY KEY ( id )
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4;

id name sex
1 aaa 0
2 bbb 0
3 ccc 1
4 ddd 1
5 eee 0

score score table:

CREATE TABLE student (
id int (11) unsigned NOT NULL AUTO_INCREMENT,
name varchar (255) NOT NULL,
sex tinyint (3) NOT NULL DEFAULT '0mm,
PRIMARY KEY ( id )
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4;

id s_id item_id score
11 1.56
21 252
3 1 3 29
4 2 1 52
52 2 61
62 3 62
7 3 1 63
83 2 74
9 3 3 52
10 4 1 83
11 42 62
12 4 3 93
13 5 1 42
14 52 52
25 5 3 83

sql statement:

the total score of each student in all subjects, the average score, the highest and the lowest.
SELECT SUM (score), AVG (score), MAX (score), MIN (score), s.s_id, u. name from score s LEFT JOIN student u
ON s.s_id = u.id
group by s.sroomid;

the total score of each discipline, the average score, the highest and the lowest.
SELECT SUM (score), AVG (score), MAX (score), MIN (score), s.item_id from score s
group by s.itemroomid;

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ae83-2c249.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ae83-2c249.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?