phpMyAdmin, localhost, mysql overhead
| From: | Jônatas Zechim | Date: | Fri, 12 Jun 2009 17:02:43 +0000 |
| Subject: | phpMyAdmin, localhost, mysql overhead | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-293981@lists.php.net to get a copy of this message | ||
Hi there, i have this table running on my localhost:
CREATE TABLE
caffecheckout_compra_itens (
compra_key varchar(23) NOT NULL,
item_id int(5) NOT NULL,
item_valor decimal(10,2) NOT NULL,
item_peso decimal(5,3) NOT NULL,
item_qtd int(3) NOT NULL,
item_data int(10) NOT NULL,
item_obs varchar(100) NOT NULL,
PRIMARY KEY (item_id),
KEY compra_key (compra_key)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
It's on my Server, but when I add a row and after remove that I'd overhead this table
(58bytes/row), anyone know why is this happening?
I run this SQL:
INSERT INTO
caffecheckout_compra_itens
(compra_key,item_id,item_valor,item_peso,item_qtd,item_data)
VALUES
('12448259804a32897ce1116','2','19.90','0.250',1,'1244825980')
ON DUPLICATE KEY UPDATE
item_qtd=item_qtd+1
And after:
DELETE FROM
caffecheckout_compra_itens
WHERE
compra_key='12448259804a32897ce1116'
Zechim
-----Mensagem original-----
De: Andrew Ballard [mailto:aballard@gmail.com]
Enviada em: sexta-feira, 12 de junho de 2009 09:38
Para: revDAVE
Cc: php-general@lists.php.net
Assunto: Re: [PHP] Field type for american money
On Thu, Jun 11, 2009 at 4:08 PM, revDAVE<Cool@hosting4days.com> wrote:
> Php - MySQL - newbie question
>
> - Field type for american money - int(11) seems to work fine
>
> - but also I tried decimal(10,2)
>
> Is one a better choice than another for american money usage?
>
>
> --
> Thanks - RevDave
> Cool @ hosting4days . com
> [db-lists 09]
It depends on what you need to store, honestly. If all your dollar
amounts are integers, int would work fine. If you need decimals,
decimal(10, 2) would be fine for a lot of applications. However, a lot
of financial applications need a little more precision. SQL Server has
a money datatype that looks like it's about equivalent to decimal(19,
4) and a smallmoney type that looks like it's equivalent to
decimal(10, 4). That handles things like gas prices that always have
that extra 9/10 of a penny tacked onto them, or items that are 3 for a
dollar. If you enter a price of 0.33 in a decimal(10, 2) field,
multiplying that by 3 will result in 0.99, whereas three items priced
at 0.3333 will come to 0.9999, which when formatted to two digits will
round to 1.00.
Andrew
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php