Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL query to do nothing (like pass)

Tags:

mysql

Many languages have a construction that fills a syntactic position of a statement but has no effect: pass in Python, \relax in TeX, CONTINUE in Fortran, ; in C and Perl.

What is its equivalent in MySQL? That is, a query that would be syntactically correct but have no effect -- apart from confusing expressions like SELECT * FROM table LIMIT 0.

This is useful when the queries are generated automatically and at some point the generation procedure is expected to generate a query but there is no action to do.

like image 944
Alexander Gelbukh Avatar asked Oct 27 '25 08:10

Alexander Gelbukh


1 Answers

This query:

SELECT 1 FROM DUAL WHERE false

or simpler in MySql 8.0+:

SELECT 1 WHERE false

return nothing, if this is what you mean when you say no effect.

like image 111
forpas Avatar answered Oct 29 '25 21:10

forpas