START
START is a command in SQL, commonly used in procedures and functions, to initiate a transaction which isolates a particular set of database actions, ensuring atomicity. It provides a way to group several actions together so that the state of the database is consistent before and after the transaction. MySQL uses START TRANSACTION command to begin a new transaction.
Example
START TRANSACTION;CREATE TABLE test (id INT, name VARCHAR(255));INSERT INTO test (id, name) VALUES (1, 'Mark');COMMIT;
Output
Query OK, 0 rows affected (0.04 sec)Query OK, 1 row affected (0.01 sec)
Explanation
The START TRANSACTION statement initiates a new transaction. Inside that transaction, a new table test
is created and a row is inserted into it. The changes are then made permanent with the COMMIT statement.
Example
START 'path/to/example_script.sql';
Output
"output text from running the example_script.sql"
Explanation
The START command in Oracle SQL is used to execute scripts. In this example, the START command is directed to execute a SQL script (example_script.sql
) located at ‘path/to/’ directory. The output of the script execution is then returned.