Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8078947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:57:12+00:00 2026-06-05T15:57:12+00:00

Given the table: CREATE TABLE IF NOT EXISTS `users` ( `id` bigint(20) NOT NULL

  • 0

Given the table:

CREATE TABLE IF NOT EXISTS `users` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

Add a couple of rows:

INSERT INTO `users` (`id`,`name`) VALUES (NULL , 'Bob'),(NULL , 'Larry'),(NULL , 'Steve');

Why, OH WHY! does this query return results:

SELECT * FROM `users` WHERE id = "2this-is-not a numeric value"

Result:

query returned 1 row(s) in 0.0003 sec
id  name
-----------------
2   Larry

The string used in the where clause is clearly being converted to a numeric value — who said to do that?! I cannot find any documentation that suggests mysql or PHP would presume to auto-cast my string literal.

This only works if the numeric character is the first one in the string, "this 2 is not numeric" would not return results. "12 2" would become 12, "1 2" (one-space-two) becomes 1.

Any articles or documentation explaining this behavior would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:57:15+00:00Added an answer on June 5, 2026 at 3:57 pm

    It’s in the MySQL documentation here:
    http://dev.mysql.com/doc/refman/5.1/en/type-conversion.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given these tables: create table Orders ( Id INT IDENTITY NOT NULL, primary key
Given the following table: create table TreeNode ( ID int not null primary key,
I've got three tables: CREATE TABLE credential_types ( id serial PRIMARY KEY, name varchar(32)
Given the following tables: CREATE TABLE IF NOT EXISTS `rank` ( `rank_id` bigint(20) NOT
Given a table such as: CREATE TABLE dbo.MyTestData (testdata varchar(50) NOT NULL) ALTER TABLE
Given the following table structure: CREATE TABLE IF NOT EXISTS `roles` ( `id` int(11)
I have two tables. Table user : CREATE TABLE IF NOT EXISTS `user` (
i have two tables CREATE TABLE IF NOT EXISTS `user` ( `user_id` int(20) NOT
Given a table (id, col1, col2), does it make sense to create the following
Given a table containing dotted quad IPv4 addresses stored as a VARCHAR(15) , for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.