You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.2 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

--Insert values on a table
INSERT INTO tbl3 VALUES (2, 'b')
INSERT INTO tbl3 VALUES (3, 'c'), (4, 'd'), (5, 'e') --Atomic
--Insert certain columns
INSERT INTO tbl1 (col1) VALUES (6)
--Insert values from a select
INSERT INTO tbl6 SELECT col1 FROM tbl1
--Insert in temporary table
INSERT INTO session.tmp1 VALUES (1)
--Update fields
UPDATE tbl3 SET col1 = 5, mycol2 = 'e' -all table
UPDATE tbl3 SET col2 = 'd' WHERE col1 = 7
--Merge (upsert)
MERGE INTO tbl3 AS t USING (SELECT col1 FROM tbl1) s ON (t.col1 = s.col1) WHEN MATCHED THEN UPDATE SET col2 = 'X' WHEN NOT MATCHED THEN INSERT VALUES (10, 'X')
--Delete rows
DELETE FROM tbl1 -all table
DELETE FROM tbl1 WHERE col1 > 5
--Export
EXPORT TO myfile OF DEL SELECT * FROM tbl1
--Import
IMPORT FROM myfile OF DEL INSERT INTO mytable1
--Cursor
DECLARE cur1 CURSOR FOR SELECT * FROM tbl1
--Load
LOAD FROM myfile OF DEL INSERT INTO tbl1
LOAD FROM cur1 OF CURSOR INSERT INTO tbl1
--Query the status of the load in a table
LOAD QUERY TABLE tbl1
--Set integrity
SET INTEGRITY FOR tbl1 IMMEDIATE CHECKED
--Ingest
INGEST FROM FILE myfile FORMAT DELIMITED INSERT INTO tbl1
--Get the next value from a sequence
VALUES NEXT VALUE FOR seq
INSERT INTO tbl3 (col1) VALUES (NEXT VALUE FOR seq)