How to insert or update rows in one statement: Databases for Developers #17

Описание к видео How to insert or update rows in one statement: Databases for Developers #17

Sometimes when adding rows to your database need update-if-exists, insert-if-not-exists logic. Aka an upsert.

You could write this as separate update and insert statements. But there is an easier way:

Merge!

Watch this video for an overview of how merge works.

Further reading:

Merge documentation: https://docs.oracle.com/en/database/o...

Delete rows not in the source using merge: https://technology.amis.nl/2006/10/14...

Take the course: https://devgym.oracle.com/pls/apex/dg...

Need help with SQL? Ask us over on AskTOM: https://asktom.oracle.com

Twitter:   / chrisrsaxon  
Daily SQL Twitter tips:   / sqldaily  
All Things SQL blog: https://blogs.oracle.com/sql/

============================
The Magic of SQL with Chris Saxon

Copyright © 2015 Oracle and/or its affiliates. Oracle is a registered trademark of Oracle and/or its affiliates. All rights reserved. Other names may be registered trademarks of their respective owners. Oracle disclaims any warranties or representations as to the accuracy or completeness of this recording, demonstration, and/or written materials (the “Materials”). The Materials are provided “as is” without any warranty of any kind, either express or implied, including without limitation warranties or merchantability, fitness for a particular purpose, and non-infringement.

Комментарии

Информация по комментариям в разработке