For a query of a SQL database table, there is a field create_time, the type is int (10), and the corresponding timestamp is stored. This data table has been stored for more than a year. Now I want to query all records of the create_time field from to every day. How can I write this SQL statement? ------ Solution ----------------------
For a query, the SQL database table has a field create_time, whose type is int (10) and the corresponding timestamp is stored. This data table has been stored for more than a year. Now I want to query all records of the create_time field from to every day. How can I write this SQL statement? ------ Solution ----------------------
SQL query
The database table has a field create_time, whose type is int (10) and stores the corresponding timestamp.
This data table has been stored for more than a year.
Now I want to query all records of the create_time field from to every day. How can I write this SQL statement?
------ Solution ----------------------
Select * from table where FROM_UNIXTIME (create_time, '% H: % I') BETWEEN '14: 00' and '20: 00'
--- [This article from the Internet (http://www.68idc.cn)] --- solution ----------------------
It is not recommended to store unix timestamps in the database. functions are required for your business and the execution efficiency will decrease.