phpMyAdmin, localhost, mysql overhead

[email protected] (Jônatas Zechim)
Newsgroups php.general
Message-ID <[email protected]>
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:[email protected]] 
Enviada em: sexta-feira, 12 de junho de 2009 09:38
Para: revDAVE
Cc: [email protected]
Assunto: Re: [PHP] Field type for american money

On Thu, Jun 11, 2009 at 4:08 PM, revDAVE<[email protected]> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.