Build Your Own DatabaseDriven Website Using PHP amp;amp; MySQL [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Build Your Own DatabaseDriven Website Using PHP amp;amp; MySQL [Electronic resources] - نسخه متنی

Kevin Yank

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید








Character Types



























CHAR(M)


Description: A fixed-length character
string.

Attributes allowed: BINARY

Maximum Length: M characters

Storage space: M bytes
(8M bits)

Notes: CHAR values
are stored as strings of length M, even though the assigned
value may be shorter. When the string does not occupy the full length of the
field, spaces are added to the end of the string to bring it to exactly M
characters. Trailing spaces are then stripped off when the value is retrieved.

CHAR columns are quicker to search than variable-length
character column types such as VARCHAR, since their fixed-length
nature makes the underlying database file format more regular.

M may take any integer value from 0 to 255, with
a CHAR(0) column able to store only two values: NULL and '' (the
empty string), and occupying only a single bit.

Alternative syntax: CHARACTER(M)


VARCHAR(M)


Description: A variable-length character
string.

Attributes allowed: BINARY

Maximum Length: M characters

Storage space: Length of stored value,
plus 1 byte to store length.

Notes: As VARCHAR values
occupy only the space they require, there is usually no point to specifying
a maximum field length M of anything less than 255 (the
maximum). Values anywhere from 1 to 255 are acceptable, however, and will
cause strings longer than the specified limit to be chopped to the maximum
length when inserted. Trailing spaces are stripped from values before they
are stored.

Alternative syntax: CHARACTER
VARYING(M)


TINYBLOB,TINYTEXT


Description: A short, variable-length
character string.

Maximum Length: 255 characters

Storage space: Length of stored value,
plus 1 byte to store length.

Notes: These types are basically equivalent
to VARCHAR(255) BINARY and VARCHAR(255),
respectively. However, these column types do not trim trailing spaces from
inserted values. The only difference between TINYBLOB and TINYTEXT is
that the former performs case-sensitive comparisons and sorts while the latter
does not.


BLOB,TEXT


Description: A variable-length character
string.

Maximum Length: 65535 characters (65KB)

Storage space: Length of stored value,
plus 2 bytes to store length.

Notes: The only difference between BLOB and TEXT is
that the former performs case-sensitive comparisons and sorts, while the latter
does not.


MEDIUMBLOB,MEDIUMTEXT


Description: A medium, variable-length
character string.

Maximum Length: 16777215 characters
(16.8MB)

Storage space: Length of stored value,
plus 3 bytes to store length.

Notes: The only difference between MEDIUMBLOB and MEDIUMTEXT is
that the former performs case-sensitive comparisons and sorts, while the latter
does not.


LONGBLOB,LONGTEXT


Description: A long, variable-length
character string.

Maximum Length: 4294967295 characters
(4.3GB)

Storage space: Length of stored value,
plus 4 bytes to store length.

Notes: The only difference between LONGBLOB and LONGTEXT is
that the former performs case-sensitive comparisons and sorts, while the latter
does not.


ENUM(value1,value2,...)


Description: A set of values from which
a single value must be chosen for each row.

Maximum Length: One value chosen from
up to 65535 possibilities.

Storage space:



1 to 255 values: 1 byte (8 bits)



256 to 65535 values: 2 bytes (16 bits)



Notes: Values in this type of field
are stored as integers that represent the element selected. 1 represents the
first element, 2 the second, and so on. The special value 0 represents the
empty string '', which is stored if a value that does not
appear in column declaration is assigned.

NOT NULL columns of this type default to the first
value in the column declaration if no particular default is assigned.


SET(value1,value2,...)


Description: A set of values, each
of which may be set or not set.

Maximum Length: Up to 64 values in
a given SET column.

Storage space:


1 to 8 values: 1 byte (8 bits)



9 to 16 values: 2 bytes (16 bits)



17 to 24 values: 3 bytes (24 bits)



25 to 32 values: 4 bytes (32 bits)



33 to 64 values: 8 bytes (64 bits)



Notes: Values in this type of field
are stored as integers representing the pattern of bits for set and unset
values. For example, if a set contains 8 values, and in a particular row the
odd values are set, then the binary representation 01010101 becomes the decimal
value 85. Values may therefore be assigned either as integers, or as a string
of set values, separated by commas (e.g. 'value1,value3,value5,value7'
= 85
). Searches should be performed either with the LIKE operator,
or the FIND_IN_SET function.


/ 190