select 1 from table
will return the constant 1 for every row of the table. It’s useful when you want to cheaply determine if record matches your where
clause and/or join
.
More Related Contents:
- SQL Query needed for fetch value from Two identical table but not fully identical table
- SQL select only rows with max value on a column [duplicate]
- How to create a MySQL hierarchical recursive query?
- Error related to only_full_group_by when executing a query in MySql
- How to reset AUTO_INCREMENT in MySQL
- How to declare a variable in MySQL?
- MySQL Query GROUP BY day / month / year
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- MySQL Cannot Add Foreign Key Constraint
- Grouping into interval of 5 minutes within a time range
- SQL counting all rows instead of counting individual rows
- Combining UNION and LIMIT operations in MySQL query
- MySQL comparison with null value
- MySQL Like multiple values
- In MySQL, should I quote numbers or not?
- Matching all values in IN clause
- MySQL add days to a date
- INTERSECT in MySQL
- mysql dynamic query in stored procedure
- Check for x consecutive days – given timestamps in database
- How do I get the ID of multiple inserted rows in MySQL?
- How to alter a column and change the default value?
- How to select one row randomly taking into account a weight?
- sql join tables where 1 column has comma
- Remove special characters from a database field
- MySQL – Replace Character in Columns
- update a column by subtracting a value
- How do you force mysql LIKE to be case sensitive? [duplicate]
- #1060 – Duplicate column name ‘id’
- In what order are MySQL JOINs evaluated?