int8.out
上传用户:blenddy
上传日期:2007-01-07
资源大小:6495k
文件大小:4k
- QUERY: CREATE TABLE INT8_TBL(q1 int8, q2 int8);
- QUERY: INSERT INTO INT8_TBL VALUES('123','456');
- QUERY: INSERT INTO INT8_TBL VALUES('123','4567890123456789');
- QUERY: INSERT INTO INT8_TBL VALUES('4567890123456789','123');
- QUERY: INSERT INTO INT8_TBL VALUES('4567890123456789','4567890123456789');
- QUERY: INSERT INTO INT8_TBL VALUES('4567890123456789','-4567890123456789');
- QUERY: SELECT * FROM INT8_TBL;
- q1| q2
- ----------------+-----------------
- 123| 456
- 123| 4567890123456789
- 4567890123456789| 123
- 4567890123456789| 4567890123456789
- 4567890123456789|-4567890123456789
- (5 rows)
- QUERY: SELECT '' AS five, q1 AS plus, -q1 AS minus FROM INT8_TBL;
- five| plus| minus
- ----+----------------+-----------------
- | 123| -123
- | 123| -123
- |4567890123456789|-4567890123456789
- |4567890123456789|-4567890123456789
- |4567890123456789|-4567890123456789
- (5 rows)
- QUERY: SELECT '' AS five, q1, q2, q1 + q2 AS plus FROM INT8_TBL;
- five| q1| q2| plus
- ----+----------------+-----------------+----------------
- | 123| 456| 579
- | 123| 4567890123456789|4567890123456912
- |4567890123456789| 123|4567890123456912
- |4567890123456789| 4567890123456789|9135780246913578
- |4567890123456789|-4567890123456789| 0
- (5 rows)
- QUERY: SELECT '' AS five, q1, q2, q1 - q2 AS minus FROM INT8_TBL;
- five| q1| q2| minus
- ----+----------------+-----------------+-----------------
- | 123| 456| -333
- | 123| 4567890123456789|-4567890123456666
- |4567890123456789| 123| 4567890123456666
- |4567890123456789| 4567890123456789| 0
- |4567890123456789|-4567890123456789| 9135780246913578
- (5 rows)
- QUERY: SELECT '' AS three, q1, q2, q1 * q2 AS multiply FROM INT8_TBL
- WHERE q1 < 1000 or (q2 > 0 and q2 < 1000);
- three| q1| q2| multiply
- -----+----------------+----------------+------------------
- | 123| 456| 56088
- | 123|4567890123456789|561850485185185047
- |4567890123456789| 123|561850485185185047
- (3 rows)
- QUERY: SELECT '' AS five, q1, q2, q1 / q2 AS divide FROM INT8_TBL;
- five| q1| q2| divide
- ----+----------------+-----------------+--------------
- | 123| 456| 0
- | 123| 4567890123456789| 0
- |4567890123456789| 123|37137318076884
- |4567890123456789| 4567890123456789| 1
- |4567890123456789|-4567890123456789| -1
- (5 rows)
- QUERY: SELECT '' AS five, q1, float8(q1) FROM INT8_TBL;
- five| q1|float8
- ----+----------------+--------------------
- | 123|123
- | 123|123
- |4567890123456789|4.56789012345679e+15
- |4567890123456789|4.56789012345679e+15
- |4567890123456789|4.56789012345679e+15
- (5 rows)
- QUERY: SELECT '' AS five, q2, float8(q2) FROM INT8_TBL;
- five| q2|float8
- ----+-----------------+---------------------
- | 456|456
- | 4567890123456789|4.56789012345679e+15
- | 123|123
- | 4567890123456789|4.56789012345679e+15
- |-4567890123456789|-4.56789012345679e+15
- (5 rows)
- QUERY: SELECT '' AS five, q1, int8(float8(q1)) AS "two coercions" FROM INT8_TBL;
- five| q1| two coercions
- ----+----------------+----------------
- | 123| 123
- | 123| 123
- |4567890123456789|4567890123456789
- |4567890123456789|4567890123456789
- |4567890123456789|4567890123456789
- (5 rows)
- QUERY: SELECT '' AS five, 2 * q1 AS "twice int4" FROM INT8_TBL;
- five| twice int4
- ----+----------------
- | 246
- | 246
- |9135780246913578
- |9135780246913578
- |9135780246913578
- (5 rows)
- QUERY: SELECT '' AS five, q1 * 2 AS "twice int4" FROM INT8_TBL;
- five| twice int4
- ----+----------------
- | 246
- | 246
- |9135780246913578
- |9135780246913578
- |9135780246913578
- (5 rows)