Archive
MySql integer numeric types
The following table shows the required storage and range for each of the integer types.
| Type | Bytes | Minimum Value | Maximum Value |
| (Signed/Unsigned) | (Signed/Unsigned) | ||
TINYINT |
1 | -128 |
127 |
0 |
255 |
||
SMALLINT |
2 | -32768 |
32767 |
0 |
65535 |
||
MEDIUMINT |
3 | -8388608 |
8388607 |
0 |
16777215 |
||
INT |
4 | -2147483648 |
2147483647 |
0 |
4294967295 |
||
BIGINT |
8 | -9223372036854775808 |
9223372036854775807 |
0 |
18446744073709551615 |
Unique visitors to post: 0MySQL LIMIT Clause
The LIMIT clause can be used to constrain the number of rows returned by the SELECT statement. LIMIT takes one or two numeric arguments, which must both be nonnegative integer constants.
With one argument:
SELECT * FROM tbl LIMIT 10; # Retrieve first 10 rows
With one argument, the value specifies the number of rows to return from the beginning of the result set.
With two arguments:
SELECT * FROM tbl LIMIT 2,20; # Retrieve rows from 3 to 22
With two arguments, the first argument specifies the offset of the first row to return, and the second specifies the maximum number of rows to return. The offset of the initial row is 0 (not 1).
Unique visitors to post: 11MySQL processing data in UTF8
Record instructions in the MySQL my.ini file for processing data in text format UTF8
[mysqld] default-character-set=utf8 default-collation=utf8_general_ci character-set-server=utf8 collation-server=utf8_general_ci init-connect='SET NAMES utf8'
[client] default-character-set=utf8
Unique visitors to post: 1Convert a Unix Time to a dot Net DateTime
I used *nix timestamp in my WEB project with MySQL database. To have a access via C# desktop program on timestamp datafield and vice versa i use this functions:
static DateTime ConvertFromUnixTimestamp(double timestamp)
{
DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0);
return origin.AddSeconds(timestamp);
}
static double ConvertToUnixTimestamp(DateTime date)
{
DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0);
TimeSpan diff = date - origin;
return Math.Floor(diff.TotalSeconds);
}
Unique visitors to post: 0