PTA shows information for male students who are 24 years old or older as of September 1, 2021. score 3

Displays the information of male students who have reached the age of 24 by September 1, 2021.

Tip: Please use the SELECT statement to answer.

Table Structure:

The SQL statement defining the table structure is as follows:

CREATE TABLE student (

sno varchar(6) NOT NULL ,

sname varchar(10) ,

sex char(2) ,

nation char(2) ,

pnum char(18) ,

birth date ,

phone char(11) ,

dept varchar(20) ,

PRIMARY KEY (sno)

) ;

table sample

student table:

Sample output:

Code length limit 16 KB

Time limit 400 ms

DatabaseMySQL

The result output requires a strict comparison of the order and data

SELECT *
FROM student
WHERE timestampdiff(year,birth,'2021-09-01') >= 24
AND sex = '男'

Guess you like

Origin blog.csdn.net/weixin_70206677/article/details/129360214