Get the App
SLTechnology News&Howtos  ›  Database  › 

Example Analysis of optimized date Operation in Oracle query

Shulou Source: shulou.com Published: 2022-05-31 21:19:06 10月28日 Update

Editor to share with you the example analysis of Oracle query optimization date operation, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Add or subtract days, months and years

In Oracle, the date type can directly add or subtract the number of days, while the addition and subtraction of months use the add_months function.

Select a.hiredate hire date, a.hiredate + 5 plus 5 days, a.hiredate-5 minus 5 days, add_months (hiredate, 5) plus 5 months, add_months (hiredate,-5) minus 5 months, add_months (hiredate, 5 * 12) plus 5 years, add_months (hiredate,-5 * 12) minus 5 years from emp a where rownum

Tags: Date hour week function month article example analysis query operation content number of days data database times encoding consistent not much most characters Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS OPPO Reno Docker Xiaomi MariaDB