Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the equivalent of 'go' in MySQL?

Tags:

sql

tsql

mysql

In TSQL I can state:

insert into myTable (ID) values (5)
GO
select * from myTable

In MySQL I can't write the same query.

What is the correct way to write this query in MySQL?

like image 618
Ahmed Mozaly Avatar asked Apr 18 '09 13:04

Ahmed Mozaly


People also ask

Is Go necessary in SQL?

They're not strictly required - they're just instructions for the SQL Server Management Studio to execute the statements up to this point now and then keep on going. GO is not a T-SQL keyword or anything - it's just an instruction that works in SSMS.

What is go in SQL stored procedure?

Using GO in SQL Server GO is not a SQL keyword. It's a batch separator used by the SQL Server Management Studio code editor tool for when more than one SQL Statement is entered in the Query window. Then Go separates the SQL statements. We can say that Go is used as a separator between transact SQL Statements.

Does MySQL 5.7 support with recursive?

MySQL version 5.7 does not offer such a feature.

How do you create a new database in MySQL?

Open the MySQL Workbench as an administrator (Right-click, Run as Admin). Click on File>Create Schema to create the database schema. Enter a name for the schema and click Apply. In the Apply SQL Script to Database window, click Apply to run the SQL command that creates the schema.


2 Answers

Semicolon at the end of the line.

INSERT INTO myTable (ID) values (5); 
like image 144
Jeff Fritz Avatar answered Sep 29 '22 12:09

Jeff Fritz


The semicolon is the default delimiter. You can however redefine it to whatever you want with the DELIMITER keyword. From the MySQL manual:

mysql> delimiter //

mysql> CREATE PROCEDURE simpleproc (OUT param1 INT)
    -> BEGIN
    ->   SELECT COUNT(*) INTO param1 FROM t;
    -> END;
    -> //
Query OK, 0 rows affected (0.00 sec)

mysql> delimiter ;

mysql> CALL simpleproc(@a);
Query OK, 0 rows affected (0.00 sec)

This is not limited to stored procedure definitions of course.

like image 32
Daniel Schneller Avatar answered Sep 29 '22 10:09

Daniel Schneller