Oracle insert, merge, query, and aggregate operations

Source: Internet
Author: User

Oracle inserts query data from one table into another table

Insert   Into T_idd_event_history (detectorcode, detectorname, loopcode, subeventtype, description, occuretime, releasetime)
Select T. detectorid, T. detectorname, T. loopcode, T. subeventtype, T. Description, T. updatetime, sysdate From T_iid_event_current t

Oracle SQL date comparison:
Before today:

Select   *   From Up_date Where   Update   < To_date ( ' 2007-09-07 00:00:00 ' , ' Yyyy-mm-dd hh24: MI: SS ' )
Select   *   From Up_date Where   Update   <= To_date ( ' 2007-09-07 00:00:00 ' , ' Yyyy-mm-dd hh24: MI: SS ' )

After today:

Select   *   From Up_date Where   Update   > To_date ( ' 2007-09-07 00:00:00 ' , ' Yyyy-mm-dd hh24: MI: SS ' )
Select   *   From Up_date Where   Update   > = To_date ( ' 2007-09-07 00:00:00 ' , ' Yyyy-mm-dd hh24: MI: SS ' )

Exact time:

Select   *   From Up_date Where   Update   = To_date ( ' 2007-09-07 00:00:00 ' , ' Yyyy-mm-dd hh24: MI: SS ' )

In a certain period of time:

Select   *   From Up_date Where   Update   Between To_date ( ' 00:00:00 ' , ' Yyyy-mm-dd hh24: MI: SS ' ) And To_date ( ' 2007-09-07 00:00:00 ' , ' Yyyy-mm-dd hh24: MI: SS ' )
Select   *   From Up_date Where   Update   < To_date ( ' 2007-09-07 00:00:00 ' , ' Yyyy-mm-dd hh24: MI: SS ' ) And   Update   > To_date ( ' 00:00:00 ' , ' Yyyy-mm-dd hh24: MI: SS ' )
Select   *   From Up_date Where   Update   <= To_date ( ' 2007-09-07 00:00:00 ' , ' Yyyy-mm-dd hh24: MI: SS ' ) And   Update   > = To_date ( ' 00:00:00 ' , ' Yyyy-mm-dd hh24: MI: SS ' )

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.