Академический Документы
Профессиональный Документы
Культура Документы
MySQL is Free.
MySQL is Open Source.
MySQL is easy to use.
Description
Optional. Specifies the server to connect to. Default value is
"localhost:3306"
Optional. Specifies the username to log in with. Default value
is the name of the user that owns the server process
Optional. Specifies the password to log in with. Default is ""
mysql_pconnect("localhost","peter","abc123"
);
Pconnect stand for persisten connect
Pconnect can not be close with mysql_close();
Syntax
CREATE DATABASE database_name
Syntax
Data Type
Storage Required
FLOAT(p)
FLOAT
4 bytes
8 bytes
DECIMAL(M,D), NUMERIC(M,D)
0 byte = 0
1 byte = 1-2
2 bytes = 34
3 bytes = 56
4 bytes = 79
BIT(M)
Data Type
Format
Range
DATE
YYYY-MM-DD
'1000-01-01' to '9999-12-31'
DATETIME[(fsp)]
YYYY-MM-DD
HH:MM:SS[.fraction]
'1000-01-01 00:00:00.000000' to
'9999-12-31 23:59:59.999999'
TIMESTAMP[(fsp)] YYYY-MM-DD
HH:MM:SS[.fraction]
TIME[(fsp)]
'-838:59:59.000000' to
'838:59:59.000000'
YEAR[(2|4)]
YYYY 4 digits
YY 2 digits
Data Type
YEAR
1 byte
1 byte
DATE
3 bytes
3 bytes
TIME
3 bytes
3 bytes + fractional
seconds storage
DATETIME
8 bytes
5 bytes + fractional
seconds storage
TIMESTAMP
4 bytes
4 bytes + fractional
seconds storage
0 bytes
1,2
1 byte
3,4
2 bytes
5,6
3 bytes
In the following table, M represents the declared column length in characters for
nonbinary string types and bytes for binary string types. L represents the actual
length in bytes of a given string value.
Data Type
Collations
CHAR
Length
Character Set
Specifications
Yes
Yes
VARCHAR
TEXT
Yes
Yes
Yes
Yes
Yes
Yes
ENUM
No
Yes
Yes
SET
No
Yes
Yes
Yes
Value
CHAR(4)
Storage
Required
VARCHAR(4)
Storage
Required
4 bytes
1 byte
ab
ab
4 bytes
ab
3 bytes
abcd
abcd
4 bytes
abcd
5 bytes
abcdefghij abcd
4 bytes
abcd
5 bytes
Empty Table
TRUNCATE table_name ;
OR
Syntax
SELECT column_name(s) FROM table_name
Example:
Firstname
Lastname
Glenn
Quagmire
Peter
Griffin