Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MYSQL


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





What Type Do U Use To Store Currency Type?


What type do you use for storing price number? Decimal?
If you use decimal, how many decimal point do u use?
I use Mysql migration toolkit to convert my access db to mysql, and my Price column has been changed to decimal(19, 4).
Anyone use decimal(19, 2)?




View Complete Forum Thread with Replies

Related Forum Messages:
What Data Type For Currency Field?
I am on MySQL 4.1.20, and need to create a table that will have fields containing US currency amounts, up to $999,999,999.99. My boss wants a webpage displaying the table, and he wants the fields to be formatted to have a dollar sign, commas, and decimals.

Am I better off making the fields varchar so the $ and , can be added -- or should I make the MySQL fields as float or decimal and then format the display on the webpage with (PHP, Javascript, ?)?

View Replies !
Best Field Type For Currency (price Of A Product)
Just wondering what you guys the best SQL field type is to store a price?

I need to be able to display this price on a website and need to be able to order by it!

Just wondered what you guys would do?

View Replies !
Precision For Decimal Field Type That Contains Currency Values
I was wondering what precision value is suitable for a decimal field that contains currency values. The values will generally be within the range of 0.01 to 10,000.00 but may be a bit more.

View Replies !
How To Store Am/pm In A Datetime Data Type
I have the following:

$now = date("Y-m-d h:i:s a");

INSERT INTO table_name (start_time) values ('$now');

Column Name -- start_time
Data Type -- datetime

I do I get the "am/pm" to be stored with the date and time so it looks something like this "2009-02-20 04:20:23 pm"?

View Replies !
Best Column Type To Store A C Structure In MySQL ?
I want to know the best column type for storing the data of a C structure variable. I am using C API for creating table and inserting the rows. If at all there is a one such type, if query the database inside the MySQL then how that column displays.

View Replies !
Field Type To Store Text With Commas
I need to change my field type to allow for commas in the field name. So I tried to change my text from "varchar" to "text". However, I am getting this error: #1170 - BLOB/TEXT column 'title' used in key specification without a key length

Can anybody tell me if text is the right type to use? If so why isn't my database allowing me to make this change?

View Replies !
I Need To Convert Date Type To String Type
I need to retrieve a Date type data from the database and present the data in my GUI as a String type.

I've tried like this :

ResultSet rs;
Date data;

data = (String)rs.getDate("ColumnName");
gui_label.setText(data);

but they say inconvertible types...

Can someone teach me the way so that I can retrieve Date type data from the database and present it in the GUI as a String type.

View Replies !
Does PK Field Type Have To Be Same As FK Filed Type?
I have a table with a primary key and, in another table, a foreign key to that 1st table needs to be set. should both fields have the same type i.e. where the PK is a 'int(11)' should the FK field be 'int' as well. And if so does it neeed to be limited to 11 as well?

View Replies !
Does Mysql Store Max Size For Data Type Each Time, Or Only What Is Needed For Specific Data?
If I use MEDIUMTEXT, which (if I understand correctly) has a max size of 65k, does mysql use the entire size each time data is written to that column? I have a text field on my site that users fill in, but more often that not, they don't. However, when they do, it can be 1000 bytes or more. Am I wasting space using MEDIUMTEXT or does mysql only set aside 1000 bytes for that column if the data is only 1000 bytes?

View Replies !
Store Currency
is double(6,2) probably the best way to go about it? (6 is just a guess, you could go higher I suppose)
what's the best way to re-add zero padding when you retrieve it? ie, 52.70 will become 52.7

View Replies !
SET Type
If I have a page that contains many checkboxes and a text area for people to input info, and these info will go to database which needs to be made searchable, I want to use Set type of column to store multiple checkbox status, but get confused.
I try some SET examples, like http://dev.mysql.com/tech-resources/articles/mysql-set-datatype.html I realized it seems elements in the set has to be defined at the time the table is created, then we can edit elements inside, but it even restrict the value that can be added, which means only a combination of two or more elements can be added into the set.
how could I implement set in order to keep tract status of a list of checkbox? Or what would be the good way implement such situation? (I have many checkbox and a text area, and I want to store them into a table)

View Replies !
What Type Use
I am wondering if someone could please tell me what type I should use if a textbox has .,()%'"/ as well as the letters of the alphabet? The type should be able to hold 255+ characters. I have tried TEXT as the type but I just get: Could not query because: Illegal mix of collations (hp8_english_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '='.

View Replies !
%TYPE
Is it possible in MySQL to use the %TYPE keyword as in Oracle? Declaring variables in stored procedures would be so much easier if I could just use some_table.some_column%TYPE rather than having to go check out what the column type is (and then have to change the variable type if the column type ever needs to change).

Also, does MySQL have the ability to store an entire row as a variable? ie. in Oracle you could do something like:

my_row some_table%ROWTYPE;

SELECT *
INTO my_row
FROM some_table
WHERE rownum = 1;

dbms_output.put_line(my_row.some_column);

I've RTFM'd but searching for "TYPE" doesn't really help in such large documentation.

View Replies !
Top 10 Of Each Type
With a table like

Code:
id score type
---------------
1 5 a
2 10 a
3 6 a
9 2 b
7 4 b
4 3 b
I want to get the top 10 scores, of each type. I know I can union a seperate query for each

Code:
(SELECT id
, score
, type
FROM scores
WHERE type = 'a'
ORDER
BY score DESC
LIMIT 10)

UNION

(SELECT id
, score
, type
FROM scores
WHERE type = 'b'
ORDER
BY score DESC
LIMIT 10)
But what do I do if I don't know how many types there are? With this method, I would need to first query for a list of types, and then dynamically build the big union query.

View Replies !
Yes OR No Data Type
Is there a yes/no boolean datatype with mySQL? I can't seem to find if there
is, and I have used an int type set to 1 or 0 but that breaks some of my
apps that used to use access which does have a yes/no field.

View Replies !
InnoDB Type
I'm using mySQL 4.0.20, interfacing it with phpMyAdmin 2.5.6.
I usually set tables up with a "default" type, which I believe is
myISAM (or whatever that one is.) But I decided to go with InnoDB for
the stability and accuracy.
Noticed something on tables in that format I've never noticed in the
other format:

tbl_product 1 InnoDB - Master Product Table; InnoDB free:
4096 kB
tbl_users 1 InnoDB - User Management Table; InnoDB free:
4096 kB

What's the meaning of "free: 4096 kB"? It sounds as though InnoDB sets
up some 4MB maximum size for the table. Is that so?

If so, is there a way to change it? I anticipate a couple of my tables
are going to end up eventually being VERY large.

View Replies !
Which Data Type
I got a column in my database called 'section' and the probable values it's going to contain look something like 001, 002, 500, 488 4A, 676 7B, etc

Which data type(and size) should I use?

Currently I'm thinking of var(size) or varchar(size)

View Replies !
ENUM Type
I have a ENUM attribute in a table. I wish to Count the number of records for each paticular type in the attribute.
Doing a SELECT COUNT(*) from 'my_table'
GROUP BY 'enum_attribute'
returns me the number of records for each particular enum.

How do I get this to list each enum type next to the count:
i.e.
column1 column2
Enum1 237
Enum2 232
Enum3 2
etc.

To clarify, I have column2, I need to know how to get column1.

View Replies !
Different Index Type
When you create a table, and give it an auto-incremented unsigned integer, you will be limiting the capacity of the table to the capacity of the data type.
My question is, if there is an implementation of any other data type for indexes in MySQL, like for example, a GUID data type (vitually unlimited), and what are the costs in performance of implementing this type of indexes.

View Replies !
Decimal Type
I've got a row that stores a number that sometimes needs to have a decimal. Right now, I have the type set to decimal(4,1)

If I insert info into the row like 8, then when i look in the database it is shown as 8.0, which works fine. but if i input 7.5 then go look in the database it is stored as 7.0. it doesnt seem to want to store the number after the decimal. its always just a 0.

View Replies !
Collation And Type
they are set on InnoDB and latin1_swedish_ci and I would to change to some different.How to change default collation and type?

View Replies !
Db Engine Type
this is one useful question , but every one know the answer ,

But few of them little bit confusion about MYSQL Database

engine ,

list out the types on database engine in MYSQL , and its

support level ,

View Replies !
Row Type To Keep Formatting
I am writing an app for our school newspaper to be posted online. I want to store everything in my MySQL db, but also want to keep the formatting when we put the articles in the DB. What should the row type be for this in order to keep the formatting (paragraphs mainly). Text puts it all together.Basically articles will be copied out of word into a <textarea> field and I would like to eliminate the need to build in a WYSIWYG editor if possible

View Replies !
Unknown SQL Type
For some reason i get this error for queries when i run them in VB.NET. But when i run the query in MySQL Query Analyzer it works perfectly fine. Is anyone familiar with this error Unknown SQL type - 0.

View Replies !
Integer Type To Use
Should I set all my int fields to "INT" type just incase they end up with millions or entries?Or should I start them with "SMALL INT" and if they need it, change the columns type to "MEDIUM INT" and so on.....
Obviously I don't want to end up in a position whereby data stops adding to my tables because it has reached its maximum int value.

View Replies !
Structure Type
I would like to create a procedure. But in this procedure it will have 20 arguments (int and char).So, It would be better to create a single argument typed as "structure" type... but I don't know if it's possible to do it?
Or perhaps there is a another meaning to do it?

View Replies !
How To Know Type Of Character Set
Any idea how to know the character set of a specific table? My hosting use mysql 4.0.27 and I can't find any info relating to character set in phpmyadmin. I could convert character set by using "ALTER TABLE `phpbb_posts_text` CHARACTER SET utf8". But I want to make sure that table is being converted.

View Replies !
Engine Type
I am using Mysql 5.0 on a PC. It has been installed for a while, so I am not sure of a few things.

I am going to try some hibernate mappings with Mysql and need to ensure I am using a "Transacted" engine from Mysql. I believe that the Transacted Engine is Innodb.

If this is true, I am not able to create the databases as Innodb, so how can I possibly ensure that all databases that I create programatically are Innodb?

Is there a system-wide setting? and if so, can I tell what engine is currently being used?

View Replies !
Field Type
i create a table:
mysql>create table a(a float);
mysql>insert into a values('39923.56');
mysql> select * from a;
+---------+
| a |
+---------+
| 39923.6 |
+---------+
1 row in set (0.00 sec)
//////////////////////////////
i do not want the round result!
i want get the values like *.??
i do not want use the DECIMAL(5,2) because it can not caculated by the cpu.
one way maybe i can use bigint then /100 get the float num!
any other ways?

View Replies !
Join Set Type
I was wondering if it is possible to join two tables together with based on a SET type field?

For instance a table that has a field SET(1,2,3,4) to a table with a id of 1 - 4. THe table with the set can have any combination of the numbers in the set and then pull one or more records from the second table. Does this make sense? It makes logical sense but can't seem to figure out a QUERY that would make that work.

View Replies !
DOUBLE Type
I want to store a length in feet value in a field... ie, 66'58". what would the appropriate and more efficient numeric type would be? Is DOUBLE my best bet and how do I call and format this using PHP?

View Replies !
Type Of Variable To Use
i would like to store long articles into a mysql table; i've these fields in the table (title, body, summerize). The 'body' field should content the whole article (the article uses to be very long 1, or 2, or 3 full paper); please what should be the type of the field 'body' (varchar, text or blob)? Why please?

View Replies !
Bit-fields Or Set-type
I'm trying to manage user privileges. My first thought was to use bit-fields. Something like:

// 1 = READ
// 2 = WRITE
// 4 = CREATE
// 8 = DELETE

// Get users whit read,write,create and delete rights:
SELECT userID FROM users WHERE privs = 15;

And using bit operators to set/get different privileges...

But then I remebered the SET-type (I allways forget about it). Which is the better to use? Personally I think the bit-field is pretty easy to manage, but which has the best performance? My guess is that the SET-type uses a bitfield anyway.... Anyone that knows what's happening behind the scene?

View Replies !
Yes/No Data Type
Does this exist in mySQL?

View Replies !
Coulmn Type Int
if i use int(20) will that mean that i will have a maximum number 20 in that field or a maximum of 20 digits?

View Replies !
Input Type
I've just made my first MySQL DB and have managed to enter most of the fields from an HTML form into it. However, I'm having trouble with checkboxes. I have 4 boxes that I'd like to enter in to 4 separate fields with a value of 0 or 1. Unfortunately I can't find an INPUT type to do this.

View Replies !
Best Table Type
What's the best table type for a comments textarea that could be up to 1000 words?

View Replies !
Type Field
At this moment I have a field with the type DATE using by default 0000-00-00. I want modify to correspond to the next example: 2006-06-06 15:30 PM. Can I register in the same field or I want to separate by other fields?

View Replies !
Which String Type Should I Use?
I am currently using a Text string type to store some webpage data. The webpage is not that large.

What is the maximum number of characters a Text string type can hold?

View Replies !
What Column Type Should This Be?
im using phpmyadmin and i want a column to be default as 1 and only able to be either 1,2,3,or 4 so which type should i put it as under column? i was thinking int but that allows any number so should it be enum or set?

View Replies !
Which Column Type Should I Use?
im going to be storing messages like a blog, so shoul i use LONGTEXT or LONGBLOB or what?

View Replies !
Default For The Type SET
I've created a database with a field of the type SET. Something like this:

SET('choice1','choice2','choice3').

The default choice is the empty ('') string. Do I have to also define the empty string in the set like this SET('choice1','choice2','choice3','') or is this not necessary?

View Replies !
Working With SET Type ...
I have this SET(&#391;',&#392;',&#393;',&#394;') on a column. Suppose that the colunm has the data (1,2,4)
Now i want to select rows that contain either 1 or 2 or 4. What is the fastest way to do this ?

View Replies !
What Field Type
I'm using a credit system in my database

what is the best field type to use for numbers which will have values added and deducted.

View Replies !
What Type Of Join
Below is my query.

select e.emp_id,e.fname,j.job_desc from employee e , jobs j
where e.job_id=j.job_id

I have not used any join in the query as I am poor towards join.

But I want to know what type of join I can use here.

View Replies !
Array Type Fields
I'm quite new to MySQL and quite impressed by its feature set. I've
also been looking at Interbase and it has a feature that allows a
multidimensional array to be stored in a single field. Does MySQL also
have this feature? I was thinking about using MySQLs GIS data types but
it only supports a two dimensional point, where as I need a three
dimensional point to be stored.


View Replies !
Text Data Type
Just how big a file can the Text data type contain (in kilobytes or Megabytes)? How big a file can a MediumText data type contain (in kilobytes or Megabytes)?

'Text' = 64 KB
'Mediumtext' = 16384 KB = 16 MB

There are a few bytes needed to store information about the field itself.

View Replies !
Incorrect Column Type
I have a table XXX which has 4 columns with types char(2), varchar(5),
int(10) and int(10) respectively.

But, when I use the following code, I don't get the correct type from
MYSQL_FIELD structure!!

int nSuccess = mysql_query ( (MYSQL*)m_hdb, "select * from XXX" );
if ( nSuccess == 0 ) {
MYSQL_RES *Result = mysql_store_result ( (MYSQL*)m_hdb );
if ( Result ) {
MYSQL_FIELD *msField;
for ( int i = 0; msField = mysql_fetch_field ( m_Result ); i++ ) {
printf ( "Column Name is %s
", msField->name );
}}}

When I am looking the msField->type values in the "Watch" window, I see
MYSQL_TYPE_LONG, MYSQL_TYPE_LONG, 1098016098 and 191985148
respectively!!

View Replies !
Data Type Question
I'm converting a desktop application Delphi/Paradox to a web server
application PHP/MySQL

What data type should I use in MySQL for the following paradox datatypes ?

Boolean ?
Currency ?

View Replies !
On Choosing The Right Type For A Column
The online MySql manual gives advice on column types for the most efficient
use of storage, but I can't find any advice on column types for the most
efficient use of computer cycles.

I know on some machines it may be faster
always to use (say) fixed length strings and unsigned integers, even if
these types take up more storage than is strictly needed. Does any reader of
this ng have an informed opinion on this matter?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved