List:General Discussion« Previous MessageNext Message »
From:Jay J Date:October 21 1999 11:06am
Subject:Re: Problem with simple CREATE
View as plain text  
----- Original Message -----
From: David D.W. Downey <pgpkeys@stripped>
To: Bob Kline <bkline@stripped>; ashay padwal <ashay007@stripped>
Cc: <mysql@stripped>
Sent: Thursday, October 21, 1999 5:56 AM
Subject: Problem with simple CREATE


> Hi Bob,
>             You seem to have your head about you,so I'm directing this to
> you specifically and also to the list in general for some more
information.
>
> I have a sample problem that comes from the Understanding SQL by Martin
> Gruber book. This appears to be a straightforward CREATE stament that
fails.
> According to what I've read in the docs, and from other sites on teh web
> that utilize MySQL, this should work. Oh and the version of MySQL is
> 3.22.29a-gamma-debug working under Windows 98 non-SE version.
>
[snip]
> I created a fresh database (just for testing with which has NO entries)
then
> tried entering the following CREATE
>
> Here is a C&P of the actual session
>
> mysql>
> mysql> CREATE TABLE Salespeople
>     -> (snum integer,
>     -> sname char(10),
>     -> city char(10),
>     -> comm decimal);
> ERROR 1064: parse error near ')' at line 5
> mysql>
>
> Any ideas? I even tried using \g instead of the ;
>
> David
> PGPKeys

Chapter 7: MySQL language reference

DECIMAL(M,D) [ZEROFILL]
An unpacked oating-point number. Cannot be unsigned. Behaves like a CHAR
column: \unpacked" means the number is stored as a string, using one
character
for each digit of the value, the decimal point, and, for negative numbers,
the
`-' sign. If D is 0, values will have no decimal point or fractional part.
The
maximum range of DECIMAL values is the same as for DOUBLE, but the actual
range for a given DECIMAL column may be constrained by the choice of M and
D.
In MySQL 3.23 the M argument no longer includes the sign or the decimal
point.
(This is according to ANSI SQL.)

mysql> CREATE TABLE Salespeople
    -> (snum integer,
    -> sname char(10),
    -> city char(10),
    -> comm decimal(6,2));   <----- line 5
Query OK, 0 rows affected (0.02 sec)

mysql> explain Salespeople;
+-------+--------------+------+-----+---------+-------+
| Field | Type         | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+-------+
| snum  | int(11)      | YES  |     | NULL    |       |
| sname | char(10)     | YES  |     | NULL    |       |
| city  | char(10)     | YES  |     | NULL    |       |
| comm  | decimal(6,2) | YES  |     | NULL    |       |
+-------+--------------+------+-----+---------+-------+
4 rows in set (0.02 sec)

-Jay J

Thread
Problem with simple CREATEDavid D.W. Downey21 Oct
  • Re: Problem with simple CREATEJay J21 Oct
  • Re: Problem with simple CREATEBob Kline21 Oct
Re: Problem with simple CREATEDavid D.W. Downey21 Oct
  • Re: Problem with simple CREATEBob Kline21 Oct
    • Re: Problem with simple CREATEMichael Widenius11 Nov
Re: Problem with simple CREATEDavid D.W. Downey21 Oct
  • Re: Problem with simple CREATEBob Kline21 Oct