Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
40
Task/Copy-a-string/DuckDB/copy-a-string.duckdb
Normal file
40
Task/Copy-a-string/DuckDB/copy-a-string.duckdb
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
D create or replace table t as (select 'This is a string' as s);
|
||||
|
||||
D from t;
|
||||
┌──────────────────┐
|
||||
│ s │
|
||||
│ varchar │
|
||||
├──────────────────┤
|
||||
│ This is a string │
|
||||
└──────────────────┘
|
||||
|
||||
# Now make two copies.
|
||||
D create or replace table tt as (select s as s1, s as s2 from t);
|
||||
|
||||
D from tt;
|
||||
┌──────────────────┬──────────────────┐
|
||||
│ s1 │ s2 │
|
||||
│ varchar │ varchar │
|
||||
├──────────────────┼──────────────────┤
|
||||
│ This is a string │ This is a string │
|
||||
└──────────────────┴──────────────────┘
|
||||
|
||||
# Change s2 and then verify that s1 is unaltered
|
||||
D UPDATE tt SET s2 = s2[1];
|
||||
|
||||
D from tt;
|
||||
┌──────────────────┬─────────┐
|
||||
│ s1 │ s2 │
|
||||
│ varchar │ varchar │
|
||||
├──────────────────┼─────────┤
|
||||
│ This is a string │ T │
|
||||
└──────────────────┴─────────┘
|
||||
|
||||
# Check that s and s1 are also still equal
|
||||
D select s = s1 from t positional join tt;
|
||||
┌──────────┐
|
||||
│ (s = s1) │
|
||||
│ boolean │
|
||||
├──────────┤
|
||||
│ true │
|
||||
└──────────┘
|
||||
Loading…
Add table
Add a link
Reference in a new issue