Quoting a string value : Char « Data Type « SQL / MySQL






Quoting a string value

    
mysql>
mysql>
mysql> CREATE TABLE dishes (
    ->     dish_id INT,
    ->     dish_name VARCHAR(255),
    ->     price DECIMAL(4,2),
    ->     is_spicy INT
    -> );
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql> INSERT INTO dishes (dish_id, dish_name, price, is_spicy) VALUES (2, 'Tso\'s Chicken', 6.75, 1);
Query OK, 1 row affected (0.00 sec)

mysql>
mysql> drop table dishes;
Query OK, 0 rows affected (0.00 sec)

   
    
    
    
  








Related examples in the same category

1.CHAR(n): character string with specified length
2.The CHAR data type is a fixed-length character data type that can store up to 255 characters.
3.Add zero to the values to force a string-to-number conversion
4.Writing Strings That Include Quotes or Special Characters
5.To include a quote character within a string that is quoted by the same kind of quote,
6.Testing String Equality or Relative Ordering
7.To find out whether a string lies within a given range of values (inclusive)
8.If you are comparing strings and numerics, or floating-point numbers and integers, MySQL will compare them as
9.Not equal char type value
10.Max with char type values
11.Compare char type value
12.Not null char type column