Let me ask you a question about mysql.

questions encountered in the interview
, a praise form, with id self-increasing primary key, w_id article id,create_time like time (in the form of 11:50:22 2018-10-02). Ask for the number of likes per article per day between 10.1 and 10.10

Sep.02,2021

this topic is quite disgusting. For a contestant like me who usually has to try SQL several times and Baidu can only write it out, there must be mistakes in handwriting.
this requires
count , no doubt
date_format , or other methods for dealing with dates, such as string interception, which is not expanded here. It is used to convert the time in the database into a date string.
group by , The number of likes per article per day, that is, the total number of entries that appear count , which are grouped by article and date.

this is what the train of thought looks like.

SELECT 
    DATE_FORMAT(`create_time`, '%Y-%m-%d') as `day`, 
    `w_id`, 
    COUNT(1) 
FROM `dianzan`
GROUP BY `day`, `w_id`;
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-1b3ee66-2c463.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-1b3ee66-2c463.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?