SAP HANA SQLScript
Write Access to the Database (DML)
18 flashcards · answers and spaced-repetition review in the KnowCard app
In SAP HANA, how do the REPLACE and UPSERT statements differ?
When UPSERT uses a WHERE clause instead of WITH PRIMARY KEY, what must that WHERE still contain?
In UPSERT table_1 SELECT ... FROM table_1 WHERE key2 = 2, what does the WHERE apply to?
What can MERGE INTO do that UPSERT cannot, and from which HANA version is it available?
Which SAP Note recommends MERGE INTO over UPDATE ... FROM, and what happens if you omit one MERGE branch?
You DELETE FROM a table, realize it was wrong, and run ROLLBACK. Does the data come back?
You TRUNCATE TABLE, realize it was wrong, and run ROLLBACK. Does the data come back?
How many rows are in table_1 after these three UPSERTs?
```
UPSERT table_1 VALUES(1,1,'a');
UPSERT table_1 VALUES(1,2,'b');
UPSERT table_1 VALUES(1,3,'c');
```
In UPDATE table_2 SET ... FROM ... WHERE ..., which tables must appear in the FROM clause?
In an UPDATE ... FROM, what goes wrong if the WHERE matches several source rows for one target row?
In an INSERT with no column list, what determines which value lands in which column?
Why prefer INSERT INTO t (col list) VALUES (...) over the positional form, even for a full-row insert?
What happens if an INSERT tries to write a NULL into a primary-key field, or a key that already exists?
You run INSERT INTO table_2 SELECT ... FROM table_1 twice. What happens the second time?
Inside a DO BEGIN ... END block, can the SELECT feeding an INSERT read a local table variable?
In an UPDATE SET clause, can the new value reference the row's own existing column values?
Given table_1 with key1 INT DEFAULT 5, what does KEY1 hold after this?
```
INSERT INTO table_1 (key2, value1)
VALUES (2, 'Defaultvalue');
```
Can the source of a MERGE INTO ... USING ... be a SELECT subquery?
Start learning today
Free to start — download the app or use it in your browser.
