1, will the following table in each of the results are more than 80 points of the name?
| Tom |
Chinese |
81 |
| Tom |
Mathematical |
75 |
| John doe |
Chinese |
76 |
| John doe |
Mathematical |
90 |
| Harry |
Chinese |
81 |
| Harry |
Mathematical |
100 |
| Harry |
English |
90 |
SELECT * from TB_STU2;
Select distinct stu2_name from TB_STU2 where Stu2_name not in
(select distinct stu2_name from TB_STU2 where stu2_score<80);
2. Output the information of the older son of the father?
CREATE TABLE Student (
stu_id int,
Stu_age int,
Stu_name varchar (30),
Stu_f int
);
Create TABLE Father (
c_id int,
C_master varchar (30)
);
INSERT into student values (1, 28, ' constructed ', 1);
INSERT into student values (2,20, ' Harry ', 1);
INSERT into student values (3,24, ' Li Ka ', 2);
INSERT into student values (4,25, ' Li Zehou ', 2);
Insert into Father values (1, ' Wang Jianlin ');
Insert into Father values (2, ' Li Ka-shing ');
#先建立父亲对儿子的一对多的关系, and then elect the respective older sons to show:
SELECT * FROM student join Father in student.stu_f=father.c_id where (student.stu_age= (select Max (stu_age) from student WH ere stu_f=1))
or (student.stu_age= (select Max (stu_age) from student where stu_f=2));
2 Categories of MySQL