Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Merge statement
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
--Title of this code --Batches are separated by 'go' select * from planes merge planes as target_planes --target table, could be common table expression using (select * from planes) as source_planes --source table, here the same as target on target_planes.Model = source_planes.Model when not matched then insert(Model, Built_date, Number_of_seats) --insert into target values(source_planes.Model, source_planes.Built_date, source_planes.Number_of_seats) when matched then /*delete*/ update set target_planes.Number_of_seats = 2*target_planes.Number_of_seats; select * from planes
View schema
Execution time: 0.02 sec, rows selected: 4, rows affected: 2, absolute service time: 0.48 sec
fork mode
|
history
|
discussion
ID
Model
Built_date
Number_of_seats
1
1
Boeing 777
5/5/1995 12:00:00 AM
300
2
2
Boeing 787 Dreamliner
7/5/2008 12:00:00 AM
310
ID
Model
Built_date
Number_of_seats
1
1
Boeing 777
5/5/1995 12:00:00 AM
600
2
2
Boeing 787 Dreamliner
7/5/2008 12:00:00 AM
620