Essex
Essex

Reputation: 6128

Insert value in a table

I have a question about inserting row in an table which is already created.

This is my table :

mysql> describe llx_document_model ;
+-------------+--------------+------+-----+---------+----------------+
| Field       | Type         | Null | Key | Default | Extra          |
+-------------+--------------+------+-----+---------+----------------+
| rowid       | int(11)      | NO   | PRI | NULL    | auto_increment |
| nom         | varchar(50)  | YES  | MUL | NULL    |                |
| entity      | int(11)      | NO   |     | 1       |                |
| type        | varchar(20)  | NO   |     | NULL    |                |
| libelle     | varchar(255) | YES  |     | NULL    |                |
| description | text         | YES  |     | NULL    |                |
+-------------+--------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)

If I print the table :

mysql> select * from llx_document_model ;
+-------+----------+--------+-------------------+---------+-------------+
| rowid | nom      | entity | type              | libelle | description |
+-------+----------+--------+-------------------+---------+-------------+
|     1 | standard |      1 | deplacement       | NULL    | NULL        |
|     7 | soleil   |      1 | ficheinter        | NULL    | NULL        |
|    13 | rouget   |      1 | shipping          | NULL    | NULL        |
|    14 | typhon   |      1 | delivery          | NULL    | NULL        |
|    16 | aurore   |      1 | supplier_proposal | NULL    | NULL        |
|    17 | muscadet |      1 | order_supplier    | NULL    | NULL        |
|    18 | baleine  |      1 | project           | NULL    | NULL        |
|    19 | einstein |      1 | order             | NULL    | NULL        |
|    21 | azur     |      1 | propal            | NULL    | NULL        |
|    23 | strato   |      1 | contract          | strato  | NULL        |
|    32 | crabe    |      1 | invoice           | crabe   | NULL        |
+-------+----------+--------+-------------------+---------+-------------+
11 rows in set (0.00 sec)

I want to add a row, so I write :

mysql> INSERT INTO llx_document_model
    -> VALUES(NULL, moriba, 1, invoice, moriba, NULL);

But I get this error :

ERROR 1054 (42S22): Unknown column 'moriba' in 'field list'

Do you have some idea about my problem ? I don't see really where I made an error.

Thank you by advance !

Upvotes: 1

Views: 37

Answers (1)

JYoThI
JYoThI

Reputation: 12085

string should be enclosed by (')single quotes

mysql> INSERT INTO llx_document_model VALUES(NULL, 'moriba', 1, 'invoice', 'moriba', NULL);

Upvotes: 1

Related Questions