
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
Can 'false' match some string in MySQL?
Yes, you can use false as 0 to match.
Let us first create a table −
mysql> create table DemoTable804 ( Id varchar(100) ); Query OK, 0 rows affected (0.66 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable804 values('101John'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable804 values('Carol1002'); Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable804 values('1000'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable804 values('1010Bob'); Query OK, 1 row affected (0.10 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable804;
This will produce the following output -
+-----------+ | Id | +-----------+ | 101John | | Carol1002 | | 1000 | | 1010Bob | +-----------+ 4 rows in set (0.00 sec)
Here is the query for false match. If a string is found at first, then it won’t convert and 0 would be visible. The same occurred in row 2 as shown below −
mysql> select 0+Id from DemoTable804;
This will produce the following output -
+------+ | 0+Id | +------+ | 101 | | 0 | | 1000 | | 1010 | +------+ 4 rows in set, 2 warnings (0.00 sec)
- Related Articles
- How to match underscore in a MySQL String?
- How can I eradicate some specific suffix or prefix or both from a MySQL string?
- Can you allow a regex match in a MySQL Select statement?
- MySQL Regular expressions: How to match digits in the string with d?
- DI String Match in Python
- How can I match a comma separated list against a value in MySQL?
- Return true or false in a MySQL select if another field contains a string?
- Select rows containing a string in a specific column with MATCH and AGAINST in MySQL
- In MySQL, how can we pad a string with another string?
- MYSQL: Can you pull results that match like 3 out of 4 expressions?
- In MySQL, without having BOOLEAN data type how can we show TRUE and FALSE values?
- Match multiple occurrences in a string with JavaScript?
- Omitting false values while constructing string in JavaScript
- How can we match the values having backslashes, like ‘a\b’, from MySQL column?
- How MySQL can perform case-sensitive string comparison?

Advertisements