SQL VQ11 Find out the maximum number of questions in a single time for sql-type questions

SQL VQ11 Find out the maximum number of questions in a single time for sql-type questions

Title: https://www.nowcoder.com/practice/7dbc7fef4f3f4ab09a01c210fcb770ce?tpId=341

data

drop table if exists questions_pass_record_detail;

CREATE TABLE `questions_pass_record_detail` (
`user_id` int NOT NULL,
`question_type` varchar(32) NOT NULL,
`device` varchar(14) NOT NULL,
`pass_count` int NOT NULL,
`date` date NOT NULL);

INSERT INTO questions_pass_record_detail VALUES(101, 'java', 'app', 2, '2020-03-01');
INSERT INTO questions_pass_record_detail VALUES(102, 'sql', 'pc', 15,'2021-07-07');
INSERT INTO questions_pass_record_detail VALUES(102, 'python', 'pc', 9, '2021-04-09');
INSERT INTO questions_pass_record_detail VALUES(104, 'python', 'app', 3,'2022-03-17');
INSERT INTO questions_pass_record_detail VALUES(105, 'sql', 'pc', 60, '2016-08-15');
INSERT INTO questions_pass_record_detail VALUES(204, 'sql', 'pc', 20, '2019-05-15');

need

Query the single maximum number of questions for sql-type questions

search result :

max(pass_count)
60

solve

Notice :

  • max : find the maximum value of the column
select
    max(pass_count)
from questions_pass_record_detail
where question_type = 'sql';

Guess you like

Origin blog.csdn.net/qq_44226094/article/details/130035891