Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to query time interval by mysql

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

How does mysql query the time interval? Many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can gain something.

How to query time interval by mysql

1. Query yesterday's data

Select * from `user` where to_days (CURDATE ())-to_days (birthday) DATE_SUB (CURDATE (), INTERVAL 7 DAY)

3. Query the data for the most recent quarter

Select * from `user` where birthday > DATE_SUB (CURDATE (), INTERVAL 3 MONTH)

4. Query the data for the last year

Select * from `user` where birthday > DATE_SUB (CURDATE (), INTERVAL 1 YEAR)

MySQL is a relational database management system developed by the Swedish company MySQL AB and belongs to the products of Oracle. MySQL is one of the most popular relational database management systems. In the aspect of WEB application, MySQL is one of the best RDBMS (Relational Database Management System) application software. MySQL is a relational database management system in which relational databases store data in different tables instead of all data in one large warehouse, which increases speed and flexibility.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report