List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:February 25 2002 11:38pm
Subject:Re: Beginner needs help
View as plain text  
At 15:33 -0800 2/25/02, Bob Rea wrote:
>I'm getting a syntax error when I try to insert more two
>sets of values into a table.
>
>I have looked at the manual on the insert statement, and
>don't see what is wrong.

The error message indicates that the problem is at the word "values".
The problem with your syntax is that "values should occur only once:

INSERT INTO tbl_name (column list) VALUES (list of values), (list of values);

>
>Can someone tell me.
>
>Here's the info.
>mysql> describe book;
>+-----------+-------------+------+-----+---------+----------------+
>| Field     | Type        | Null | Key | Default | Extra   
>       |
>+-----------+-------------+------+-----+---------+----------------+
>| booknum   | int(20)     |      | PRI | NULL    |
>auto_increment |
>| isbn      | varchar(14) | YES  |     | NULL    |         
>       |
>| title     | varchar(50) | YES  |     | NULL    |         
>       |
>| authlname | varchar(20) | YES  |     | NULL    |         
>       |
>| authfname | varchar(20) | YES  |     | NULL    |         
>       |
>| publisher | varchar(20) | YES  |     | NULL    |         
>       |
>| pubdate   | date        | YES  |     | NULL    |         
>       |
>| dewey     | varchar(20) | YES  |     | NULL    |         
>       |
>| lcnum     | varchar(20) | YES  |     | NULL    |         
>       |
>| checkin   | date        | YES  |     | NULL    |         
>       |
>| checkout  | date        | YES  |     | NULL    |         
>       |
>| duedate   | date        | YES  |     | NULL    |         
>       |
>+-----------+-------------+------+-----+---------+----------------+
>12 rows in set (0.00 sec)
>
>Here's the attempt:
>mysql> INSERT into book(
>     -> isbn,
>     -> title,
>     -> authlname,
>     -> authfname,
>     -> publisher,
>     -> pubdate,
>     -> dewey,
>     -> lcnum
>     -> )
>     -> values (
>     -> '1-56592-434-7',
>     -> 'MySQL & mSQL',
>     -> 'Yarger',
>     -> 'Randy Jay',
>     -> "O'Reilly",
>     -> null,
>     -> null,
>     -> null
>     -> ),
>     -> values(
>     -> '0-312-25313-3',
>     -> 'Coup de Grace',
>     -> 'Borthwick',
>     -> 'J S',
>     -> "St Martin's Minotaur",
>     -> null,
>     -> '813.54-dc21',
>     -> 'PS3552.O756 C68 2000'
>     -> );
>ERROR 1064: You have an error in your SQL syntax near
>'values(
>'0-312-25313-3',
>'Coup de Grace',
>'Borthwick',
>'J S',
>"St Martin's Minot' at line 21
>
>TIA
>
>--
>Bob Rea
>
>**************************************************
>    "On the side of the box, under 'System
>     Requirements', it said 'Requires Windows
>     95 or better'. So I installed Linux."
>**************************************************
>
>sfpetard@stripped  http://home.earthlink.net/~sfpetard/
>
>---------------------------------------------------------------------
>Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <mysql-thread100999@stripped>
>To unsubscribe, e-mail <mysql-unsubscribe-paul=snake.net@stripped>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Thread
Beginner needs helpBob Rea26 Feb
  • Re: Beginner needs helpPaul DuBois26 Feb
  • Re: Beginner needs helpGeorg Richter26 Feb
  • Re: Beginner needs helpNathan26 Feb
  • RE: Beginner needs helpDaniel Rosher26 Feb
  • Re: Beginner needs helpdaniel26 Feb
    • Re: Beginner needs helpMichael Stassen26 Feb
RE: Beginner needs helpEric Mayers26 Feb