If the table contains an auto-incremented key or identity column, and the row was updated, the generated key is set to 0; otherwise it is set to the new key.Example: MERGE INTO TEST KEY(ID) VALUES(2, ' World') Runs a SQL script from a file.

updating multiple rows in mysql-18updating multiple rows in mysql-19updating multiple rows in mysql-81

The password must be in single quotes; it is case sensitive and can contain spaces. To read a stream from the classpath, use the prefix 'classpath:'.

See the Pluggable File System section on the Advanced page. Example: RUNSCRIPT FROM 'backup.sql' RUNSCRIPT FROM 'classpath:/com/acme/test.sql' SCRIPT [ SIMPLE ] [ NODATA ] [ NOPASSWORDS ] [ NOSETTINGS ] [ DROP ] [ BLOCKSIZE block Size Int ] [ TO file Name String script Compression Encryption [ CHARSET charset String ] ] [ TABLE table Name [, ...] ] [ SCHEMA schema Name [, ...] ] file Name' clause is specified, the script is returned as a result set.

The compression algorithm must match the one used when creating the script. This command can be used to create a backup of the database.

ALTER INDEX RENAME ALTER SCHEMA RENAME ALTER SEQUENCE ALTER TABLE ADD ALTER TABLE ADD CONSTRAINT ALTER TABLE RENAME CONSTRAINT ALTER TABLE ALTER COLUMN ALTER TABLE DROP COLUMN ALTER TABLE DROP CONSTRAINT ALTER TABLE SET ALTER TABLE RENAME ALTER USER ADMIN ALTER USER RENAME ALTER USER SET PASSWORD ALTER VIEW ANALYZE COMMENT CREATE AGGREGATE CREATE ALIAS CREATE CONSTANT CREATE DOMAIN CREATE INDEX CREATE LINKED TABLE CREATE ROLE CREATE SCHEMA CREATE SEQUENCE CREATE TABLE CREATE TRIGGER CREATE USER CREATE VIEW CHECKPOINT CHECKPOINT SYNC COMMIT COMMIT TRANSACTION GRANT RIGHT GRANT ALTER ANY SCHEMA GRANT ROLE HELP PREPARE COMMIT REVOKE RIGHT REVOKE ROLE ROLLBACK ROLLBACK TRANSACTION SAVEPOINT SET @ SET ALLOW_LITERALS SET AUTOCOMMIT SET CACHE_SIZE SET CLUSTER SET BINARY_COLLATION SET COLLATION SET COMPRESS_LOB SET DATABASE_EVENT_LISTENER SET DB_CLOSE_DELAY SET DEFAULT_LOCK_TIMEOUT SET DEFAULT_TABLE_TYPE SET EXCLUSIVE SET IGNORECASE SET JAVA_OBJECT_SERIALIZER SET LOG SET LOCK_MODE SET LOCK_TIMEOUT SET MAX_LENGTH_INPLACE_LOB SET MAX_LOG_SIZE SET MAX_MEMORY_ROWS SET MAX_MEMORY_UNDO SET MAX_OPERATION_MEMORY SET MODE SET MULTI_THREADED SET OPTIMIZE_REUSE_RESULTS SET PASSWORD SET QUERY_STATISTICS SET QUERY_STATISTICS_MAX_ENTRIES SET QUERY_TIMEOUT SET REFERENTIAL_INTEGRITY SET RETENTION_TIME SET SALT HASH SET SCHEMA SET SCHEMA_SEARCH_PATH SET THROTTLE SET TRACE_LEVEL SET TRACE_MAX_FILE_SIZE SET UNDO_LOG SET WRITE_DELAY SHUTDOWN SELECT [ TOP term ] [ DISTINCT | ALL ] select Expression [,...] FROM table Expression [,...] [ WHERE expression ] [ GROUP BY expression [,...] ] [ HAVING expression ] [ { UNION [ ALL ] | MINUS | EXCEPT | INTERSECT } select ] [ ORDER BY order [,...] ] [ [ LIMIT expression ] [ OFFSET expression ] [ SAMPLE_SIZE row Count Int ] ] [ FOR UPDATE ] queries or joins are not allowed in this case.

Example: SELECT * FROM TEST; SELECT * FROM TEST ORDER BY NAME; SELECT ID, COUNT(*) FROM TEST GROUP BY ID; SELECT NAME, COUNT(*) FROM TEST GROUP BY NAME HAVING COUNT(*) 2; SELECT ' ID' COL, MAX(ID) AS MAX FROM TEST UNION SELECT ' NAME', MAX(NAME) FROM TEST; SELECT * FROM TEST LIMIT 1000; SELECT * FROM (SELECT ID, COUNT(*) FROM TEST GROUP BY ID UNION SELECT NULL, COUNT(*) FROM TEST) ORDER BY 1 NULLS LAST; INSERT INTO table Name { [ ( column Name [,...] ) ] { VALUES { ( { DEFAULT | expression } [,...] ) } [,...] | [ DIRECT ] [ SORTED ] select } } | { SET { column Name = { DEFAULT | expression } } [,...] } UPDATE table Name [ [ AS ] new Table Alias ] SET { { column Name = { DEFAULT | expression } } [,...] } | { ( column Name [,...] ) = ( select ) } [ WHERE expression ] [ ORDER BY order [,...] ] [ LIMIT expression ] Backs up the database files to a file.

Objects are not locked, but the backup is transactionally consistent because the transaction log is also copied. Example: BACKUP TO 'backup.zip' Calculates a simple expression.

This statement returns a result set with one row, except if the called function returns a result set itself.

If the called function returns an array, then each element in this array is returned as a column.

Example: CALL 15*25 Updates existing rows, and insert rows that don't exist.