MySQL Tutorial/Insert Update Delete/Quotation Mark

Материал из SQL эксперт
Версия от 09:50, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Insert double quotation mark by using the single quote

mysql>
mysql> CREATE TABLE Employee(
    ->     id            int,
    ->     first_name    VARCHAR(15),
    ->     last_name     VARCHAR(15),
    ->     start_date    DATE,
    ->     end_date      DATE,
    ->     salary        FLOAT(8,2),
    ->     city          VARCHAR(10),
    ->     description   VARCHAR(15)
    -> );
Query OK, 0 rows affected (0.03 sec)
mysql>
mysql>
mysql> select * from Employee;
Empty set (0.00 sec)
mysql>
mysql> insert into employee (first_name)value("A"s");
Query OK, 1 row affected (0.01 sec)
mysql>
mysql> select * from Employee;
+------+------------+-----------+------------+----------+--------+------+-------------+
| id   | first_name | last_name | start_date | end_date | salary | city | description |
+------+------------+-----------+------------+----------+--------+------+-------------+
| NULL | A"s        | NULL      | NULL       | NULL     |   NULL | NULL | NULL        |
+------+------------+-----------+------------+----------+--------+------+-------------+
1 row in set (0.00 sec)
mysql>
mysql>
mysql> drop table Employee;
Query OK, 0 rows affected (0.02 sec)
mysql>


Insert single quotation mark by using the double quote

mysql>
mysql> CREATE TABLE Employee(
    ->     id            int,
    ->     first_name    VARCHAR(15),
    ->     last_name     VARCHAR(15),
    ->     start_date    DATE,
    ->     end_date      DATE,
    ->     salary        FLOAT(8,2),
    ->     city          VARCHAR(10),
    ->     description   VARCHAR(15)
    -> );
Query OK, 0 rows affected (0.03 sec)
mysql>
mysql>
mysql> select * from Employee;
Empty set (0.00 sec)
mysql>
mysql>
mysql> Insert into employee (first_name)value("Keith"s");
Query OK, 1 row affected (0.00 sec)
mysql>
mysql>
mysql> select * from Employee;
+------+------------+-----------+------------+----------+--------+------+-------------+
| id   | first_name | last_name | start_date | end_date | salary | city | description |
+------+------------+-----------+------------+----------+--------+------+-------------+
| NULL | Keith"s    | NULL      | NULL       | NULL     |   NULL | NULL | NULL        |
+------+------------+-----------+------------+----------+--------+------+-------------+
1 row in set (0.00 sec)
mysql>
mysql>
mysql> drop table Employee;
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql>