
- 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 we use backticks with column value in MySQL?
You cannot use backticks with column value. For this, use only table name or column name. If you use backtick with column value then MySQL will give the following error message:
ERROR 1054 (42S22): Unknown column '191.23.41.10' in 'where clause'
Let us first create a table:
mysql> create table DemoTable6 ( SystemIPAddress varchar(200) ); Query OK, 0 rows affected (0.46 sec)
Following is the query to insert some records in the table using insert command:
mysql> insert into DemoTable values('192.68.1.0'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable values('191.23.41.10'); Query OK, 1 row affected (0.12 sec)
Now you can display specific record from the table using select statement:
mysql> select *from DemoTable where SystemIPAddress=`191.23.41.10`;
This will produce the following output i.e. an error since we used backtick with column value:
ERROR 1054 (42S22): Unknown column '191.23.41.10' in 'where clause'
Let us see the correct way to display the same record:
mysql> select *from DemoTable where SystemIPAddress='191.23.41.10';
This will produce the following output:
+-----------------+ | SystemIPAddress | +-----------------+ | 191.23.41.10 | +-----------------+ 1 row in set (0.00 sec)
- Related Articles
- Can we use current_date() for table with column timestamp default in MySQL?
- How can we use MySQL EXPORT_SET() function with column of a table?
- How can we use MySQL function STR_TO_DATE(Column, ‘%input_format’)?
- Why can't we use column name “desc” in MySQL?
- Can we use reserved word ‘index’ as MySQL column name?
- Can we use “rank” as column name with MySQL8?
- Can we use “year” as a column came in a MySQL Table?
- Can we use MySQL keyword as alias name for a column?
- How can we create MySQL views with column list?
- Can we use str_replace in MySQL?
- How can we combine ROW selection with COLUMN selection in MySQL?
- How can we use SIGNAL statement with MySQL triggers?
- Can we use IFNULL along with MySQL ORDER BY?
- How can we use LPAD() or RPAD() functions with the values in the column of a MySQL table?
- In MySQL, how can we use FROM_UNIXTIME() function with format string?

Advertisements