Jump to content


Photo

INT, VARCHAR, etc...


  • Faça o login para participar
5 replies to this topic

#1 Chinello Cybernético

Chinello Cybernético

    Simplesmente "Chinello"

  • Usuários
  • 1892 posts
  • Sexo:Masculino
  • Localidade:Canoas - RS

Posted 27/01/2003, 01:02

Ae galera..

Eu até sei mais ou menos pra que usar..

Tipo: INT é só número, aí tem o "INT grande" (BIGINT)..

Mas assim, eu gostaria de ver umas explicações mais técnicas e teóricas, pois a teoria é muito importante...

Quem souber direitinhu, diz ae... Ah, pode citar um exemplo tb de como usar todos esse bagulhinhos que eu neim sei o nome... :D

Valew..

Fui.. :P
Diego Sampaio - kroW - PHP Framework > http://chinelloweb.net/
chinello at gmail dot com

System > Athlon 64 3200+ Mobile | Kubuntu 7.04 Fesity Fawn AMD64 | Kernel 2.6.20-16
Coding @ KDE 3.5.7 | PHP 5.2.1 | Apache 2.2.3 | MySQL 5.0.38

#2 wmonline

wmonline

    Webmaster

  • Admin Geral
  • 238 posts
  • Sexo:Masculino

Posted 27/01/2003, 11:23

Olá,

Acho que aqui estará todas as suas respostas (Copy-n-Paste, desculpa o inglês) :


TINYINT[(M)] [UNSIGNED] [ZEROFILL]
A very small integer. The signed range is -128 to 127. The unsigned range is 0 to 255.

SMALLINT[(M)] [UNSIGNED] [ZEROFILL]
A small integer. The signed range is -32768 to 32767. The unsigned range is 0 to 65535.

MEDIUMINT[(M)] [UNSIGNED] [ZEROFILL]
A medium-size integer. The signed range is -8388608 to 8388607. The unsigned range is 0 to 16777215.

INT[(M)] [UNSIGNED] [ZEROFILL]
A normal-size integer. The signed range is -2147483648 to 2147483647. The unsigned range is 0 to 4294967295.

INTEGER[(M)] [UNSIGNED] [ZEROFILL]
This is a synonym for INT.

BIGINT[(M)] [UNSIGNED] [ZEROFILL]
A large integer. The signed range is -9223372036854775808 to 9223372036854775807. The unsigned range is 0 to 18446744073709551615. Some things you should be aware of with respect to BIGINT columns:
All arithmetic is done using signed BIGINT or DOUBLE values, so you shouldn't use unsigned big integers larger than 9223372036854775807 (63 bits) except with bit functions! If you do that, some of the last digits in the result may be wrong because of rounding errors when converting the BIGINT to a DOUBLE. MySQL 4.0 can handle BIGINT in the following cases:
Use integers to store big unsigned values in a BIGINT column.
In MIN(big_int_column) and MAX(big_int_column).
When using operators (+, -, *, etc.) where both operands are integers.
You can always store an exact integer value in a BIGINT column by storing it as a string. In this case, MySQL will perform a string-to-number conversion that involves no intermediate double representation.
`-', `+', and `*' will use BIGINT arithmetic when both arguments are integer values! This means that if you multiply two big integers (or results from functions that return integers) you may get unexpected results when the result is larger than 9223372036854775807.

FLOAT(precision) [UNSIGNED] [ZEROFILL]
A floating-point number. precision can be <=24 for a single-precision floating-point number and between 25 and 53 for a double-precision floating-point number. These types are like the FLOAT and DOUBLE types described immediately below. FLOAT(X) has the same range as the corresponding FLOAT and DOUBLE types, but the display size and number of decimals are undefined. In MySQL Version 3.23, this is a true floating-point value. In earlier MySQL versions, FLOAT(precision) always has 2 decimals. Note that using FLOAT may give you some unexpected problems as all calculations in MySQL are done with double precision. See section A.5.6 Solving Problems with No Matching Rows. This syntax is provided for ODBC compatibility.

FLOAT[(M,D)] [UNSIGNED] [ZEROFILL]
A small (single-precision) floating-point number. Allowable values are -3.402823466E+38 to -1.175494351E-38, 0, and 1.175494351E-38 to 3.402823466E+38. If UNSIGNED is specified, negative values are disallowed. The M is the display width and D is the number of decimals. FLOAT without arguments or FLOAT(X) where X <= 24 stands for a single-precision floating-point number.

DOUBLE[(M,D)] [UNSIGNED] [ZEROFILL]
A normal-size (double-precision) floating-point number. Allowable values are -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and 2.2250738585072014E-308 to 1.7976931348623157E+308. If UNSIGNED is specified, negative values are disallowed. The M is the display width and D is the number of decimals. DOUBLE without arguments or FLOAT(X) where 25 <= X <= 53 stands for a double-precision floating-point number.
DOUBLE PRECISION[(M,D)] [UNSIGNED] [ZEROFILL]

REAL[(M,D)] [UNSIGNED] [ZEROFILL]
These are synonyms for DOUBLE.

DECIMAL[(M[,D])] [UNSIGNED] [ZEROFILL]
An unpacked floating-point number. 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, are not counted in M (but space for these is reserved). 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. If UNSIGNED is specified, negative values are disallowed. If D is omitted, the default is 0. If M is omitted, the default is 10. Prior to MySQL Version 3.23, the M argument must include the space needed for the sign and the decimal point.
DEC[(M[,D])] [UNSIGNED] [ZEROFILL]
NUMERIC[(M[,D])] [UNSIGNED] [ZEROFILL]
These are synonyms for DECIMAL.

DATE
A date. The supported range is '1000-01-01' to '9999-12-31'. MySQL displays DATE values in 'YYYY-MM-DD' format, but allows you to assign values to DATE columns using either strings or numbers. See section 6.2.2.2 The DATETIME, DATE, and TIMESTAMP Types.

DATETIME
A date and time combination. The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'. MySQL displays DATETIME values in 'YYYY-MM-DD HH:MM:SS' format, but allows you to assign values to DATETIME columns using either strings or numbers. See section 6.2.2.2 The DATETIME, DATE, and TIMESTAMP Types.

TIMESTAMP[(M)]
A timestamp. The range is '1970-01-01 00:00:00' to sometime in the year 2037. MySQL displays TIMESTAMP values in YYYYMMDDHHMMSS, YYMMDDHHMMSS, YYYYMMDD, or YYMMDD format, depending on whether M is 14 (or missing), 12, 8, or 6, but allows you to assign values to TIMESTAMP columns using either strings or numbers. A TIMESTAMP column is useful for recording the date and time of an INSERT or UPDATE operation because it is automatically set to the date and time of the most recent operation if you don't give it a value yourself. You can also set it to the current date and time by assigning it a NULL value. See section 6.2.2 Date and Time Types. The M argument affects only how a TIMESTAMP column is displayed; its values always are stored using 4 bytes each. Note that TIMESTAMP(M) columns where M is 8 or 14 are reported to be numbers while other TIMESTAMP(M) columns are reported to be strings. This is just to ensure that one can reliably dump and restore the table with these types! See section 6.2.2.2 The DATETIME, DATE, and TIMESTAMP Types.

TIME
A time. The range is '-838:59:59' to '838:59:59'. MySQL displays TIME values in 'HH:MM:SS' format, but allows you to assign values to TIME columns using either strings or numbers. See section 6.2.2.3 The TIME Type.
YEAR[(2|4)]
A year in 2- or 4-digit format (default is 4-digit). The allowable values are 1901 to 2155, 0000 in the 4-digit year format, and 1970-2069 if you use the 2-digit format (70-69). MySQL displays YEAR values in YYYY format, but allows you to assign values to YEAR columns using either strings or numbers. (The YEAR type is unavailable prior to MySQL Version 3.22.) See section 6.2.2.4 The YEAR Type.
[NATIONAL] CHAR(M) [BINARY]
A fixed-length string that is always right-padded with spaces to the specified length when stored. The range of M is 0 to 255 characters (1 to 255 prior to MySQL Version 3.23). Trailing spaces are removed when the value is retrieved. CHAR values are sorted and compared in case-insensitive fashion according to the default character set unless the BINARY keyword is given. NATIONAL CHAR (or its equivalent short form, NCHAR) is the ANSI SQL way to define that a CHAR column should use the default CHARACTER set. This is the default in MySQL. CHAR is a shorthand for CHARACTER. MySQL allows you to create a column of type CHAR(0). This is mainly useful when you have to be compliant with some old applications that depend on the existence of a column but that do not actually use the value. This is also quite nice when you need a column that only can take 2 values: A CHAR(0), that is not defined as NOT NULL, will occupy only one bit and can take only 2 values: NULL or "". See section 6.2.3.1 The CHAR and VARCHAR Types.

CHAR
This is a synonym for CHAR(1).
[NATIONAL] VARCHAR(M) [BINARY]
A variable-length string. Note: trailing spaces are removed when the value is stored (this differs from the ANSI SQL specification). The range of M is 0 to 255 characters (1 to 255 prior to MySQL Version 4.0.2). VARCHAR values are sorted and compared in case-insensitive fashion unless the BINARY keyword is given. See section 6.5.3.1 Silent Column Specification Changes. VARCHAR is a shorthand for CHARACTER VARYING. See section 6.2.3.1 The CHAR and VARCHAR Types.

TINYBLOB
TINYTEXT
A BLOB or TEXT column with a maximum length of 255 (2^8 - 1) characters. See section 6.5.3.1 Silent Column Specification Changes. See section 6.2.3.2 The BLOB and TEXT Types.

BLOB
TEXT
A BLOB or TEXT column with a maximum length of 65535 (2^16 - 1) characters. See section 6.5.3.1 Silent Column Specification Changes. See section 6.2.3.2 The BLOB and TEXT Types.

MEDIUMBLOB
MEDIUMTEXT
A BLOB or TEXT column with a maximum length of 16777215 (2^24 - 1) characters. See section 6.5.3.1 Silent Column Specification Changes. See section 6.2.3.2 The BLOB and TEXT Types.

LONGBLOB
LONGTEXT
A BLOB or TEXT column with a maximum length of 4294967295 (2^32 - 1) characters. See section 6.5.3.1 Silent Column Specification Changes. Note that because the server/client protocol and MyISAM tables has currently a limit of 16M per communication packet / table row, you can't yet use this the whole range of this type. See section 6.2.3.2 The BLOB and TEXT Types.
ENUM('value1','value2',...)
An enumeration. A string object that can have only one value, chosen from the list of values 'value1', 'value2', ..., NULL or the special "" error value. An ENUM can have a maximum of 65535 distinct values. See section 6.2.3.3 The ENUM Type.
SET('value1','value2',...)
A set. A string object that can have zero or more values, each of which must be chosen from the list of values 'value1', 'value2', ... A SET can have a maximum of 64 members. See section 6.2.3.4 The SET Type.


Referência : http://www.mysql.com...lumn_types.html

#3 007

007
  • Visitantes

Posted 27/01/2003, 14:37

bom uma rapida explicacao dos principais ..

int - vc usa pra numeros .. numeros como o primrio por exemplo, id, essas coisas ..

varchar - textos, otimo para emails, numeros de telefone, enderecos .. em fim, nada maior doq uns 200 caraters ..

text - pra textos, em geral .. pode usar pra textos grandes ..

blob - pra texto de arkivos, como textos de imagens, de zips .. e tal .. se so vai precisar se vc kiser colocar arkivos no bd ..

com esses ai vc ja faz MTA coisa ..

vc sabe ne, onde tem mta coisa, grande parte é LINGUIÇA!

#4 Chinello Cybernético

Chinello Cybernético

    Simplesmente "Chinello"

  • Usuários
  • 1892 posts
  • Sexo:Masculino
  • Localidade:Canoas - RS

Posted 27/01/2003, 23:47

Ae 007, ae Leandro..

Valew..

Já ajudaram muito...

Fui.. :P
Diego Sampaio - kroW - PHP Framework > http://chinelloweb.net/
chinello at gmail dot com

System > Athlon 64 3200+ Mobile | Kubuntu 7.04 Fesity Fawn AMD64 | Kernel 2.6.20-16
Coding @ KDE 3.5.7 | PHP 5.2.1 | Apache 2.2.3 | MySQL 5.0.38

#5 MaXiMuS

MaXiMuS

    o cara que escreve engraçado

  • Usuários
  • 785 posts
  • Sexo:Não informado
  • Localidade:Guarulhos - SP - Brasil

Posted 28/01/2003, 00:13

claru ki naum...

intaum diga...
qdu devu usar o tinytext, o text i o longtext?

quais as variacoes de cada um?

Isso é muito importante para se definir um banco de dados

um banco de dados mal istruturado eh tempo perdido futuramente

#6 aSmeriaWer

aSmeriaWer

    Novato no fórum

  • Usuários
  • 4 posts
  • Sexo:Não informado
  • Localidade:Meu pc

Posted 02/08/2011, 22:37

These days almost everything needs cash and when we are quick on money it can leave us in a quite difficult spot. When you are faced with the stress of not getting able to meet your monetary commitments then you could be left with small alternative but to technique payday loan a payday mortgage immediate loan provider.

There are a big number of payday loan direct loan provider organizations about these days and this is mostly due to the fact there is a significant need for these dollars loans. With more and much more cash loans people sensation the pressures of difficult financial times an escalating amount are needing some quick term monetary relief with cash advance loans.

Payday loan direct lender companies have obtained a bit of a shake up not too long ago payday loan with new legislation currently being brought in to protect borrowers from these unscrupulous loan companies who looked to consider gain of borrowers and basically give the payday mortgage industry a negative title. These new regulations, though diverse from state to state, have established greater phrases for consumers cash loans and now suggest that payday loan immediate loan provider companies are now restricted in regard to how significantly they can mortgage and how considerably they are capable to cost their customers.

When folks require money in a hurry, in most circumstances a payday mortgage immediate payday loans loan provider is their only option. Financial institution loans can take a extended time to method and generally these greater loan companies will not let men and women to borrow a modest income sum. There is also a substantial sum payday loans online of documentation required in order to get a mortgage from a bank and applying for these loans can be a true trouble.

When you acquire dollars from a payday mortgage immediate loan provider you will be granted practically instant approval and find the money from your cash advance in your account in payday loans 24 hrs. Due to the fact the dollars developments provided by a payday loan immediate financial institution need only your paycheck as collateral, you will not be issue to rigorous credit checks or be necessary to submit a mountain of paperwork to support your mortgage application.

To apply for a loan by way of a payday mortgage direct payday loans no credit check financial institution all you want to do is complete a straightforward software sort. These programs can be finished possibly on-line or in particular person and will be accredited virtually immediately. When you utilize for your cash advance through payday loans online a payday mortgage direct lender you will want to full a mortgage repayment type. This is because these loans usually need to be repaid inside of the month and so these repayment agreements authorize the financial institution to immediately debit your exceptional mortgage payday loans balance from you financial institution account on the due date. A lot of folks find this repayment technique extremely easy as they do not require to remember when their repayments are because of and therefore, will not risk any overdue fees that may possibly be related with these loans.




1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq