int8.out
上传用户:blenddy
上传日期:2007-01-07
资源大小:6495k
文件大小:4k
源码类别:

数据库系统

开发平台:

Unix_Linux

  1. QUERY: CREATE TABLE INT8_TBL(q1 int8, q2 int8);
  2. QUERY: INSERT INTO INT8_TBL VALUES('123','456');
  3. QUERY: INSERT INTO INT8_TBL VALUES('123','4567890123456789');
  4. QUERY: INSERT INTO INT8_TBL VALUES('4567890123456789','123');
  5. QUERY: INSERT INTO INT8_TBL VALUES('4567890123456789','4567890123456789');
  6. QUERY: INSERT INTO INT8_TBL VALUES('4567890123456789','-4567890123456789');
  7. QUERY: SELECT * FROM INT8_TBL;
  8.               q1|               q2
  9. ----------------+-----------------
  10.              123|              456
  11.              123| 4567890123456789
  12. 4567890123456789|              123
  13. 4567890123456789| 4567890123456789
  14. 4567890123456789|-4567890123456789
  15. (5 rows)
  16. QUERY: SELECT '' AS five, q1 AS plus, -q1 AS minus FROM INT8_TBL;
  17. five|            plus|            minus
  18. ----+----------------+-----------------
  19.     |             123|             -123
  20.     |             123|             -123
  21.     |4567890123456789|-4567890123456789
  22.     |4567890123456789|-4567890123456789
  23.     |4567890123456789|-4567890123456789
  24. (5 rows)
  25. QUERY: SELECT '' AS five, q1, q2, q1 + q2 AS plus FROM INT8_TBL;
  26. five|              q1|               q2|            plus
  27. ----+----------------+-----------------+----------------
  28.     |             123|              456|             579
  29.     |             123| 4567890123456789|4567890123456912
  30.     |4567890123456789|              123|4567890123456912
  31.     |4567890123456789| 4567890123456789|9135780246913578
  32.     |4567890123456789|-4567890123456789|               0
  33. (5 rows)
  34. QUERY: SELECT '' AS five, q1, q2, q1 - q2 AS minus FROM INT8_TBL;
  35. five|              q1|               q2|            minus
  36. ----+----------------+-----------------+-----------------
  37.     |             123|              456|             -333
  38.     |             123| 4567890123456789|-4567890123456666
  39.     |4567890123456789|              123| 4567890123456666
  40.     |4567890123456789| 4567890123456789|                0
  41.     |4567890123456789|-4567890123456789| 9135780246913578
  42. (5 rows)
  43. QUERY: SELECT '' AS three, q1, q2, q1 * q2 AS multiply FROM INT8_TBL
  44.  WHERE q1 < 1000 or (q2 > 0 and q2 < 1000);
  45. three|              q1|              q2|          multiply
  46. -----+----------------+----------------+------------------
  47.      |             123|             456|             56088
  48.      |             123|4567890123456789|561850485185185047
  49.      |4567890123456789|             123|561850485185185047
  50. (3 rows)
  51. QUERY: SELECT '' AS five, q1, q2, q1 / q2 AS divide FROM INT8_TBL;
  52. five|              q1|               q2|        divide
  53. ----+----------------+-----------------+--------------
  54.     |             123|              456|             0
  55.     |             123| 4567890123456789|             0
  56.     |4567890123456789|              123|37137318076884
  57.     |4567890123456789| 4567890123456789|             1
  58.     |4567890123456789|-4567890123456789|            -1
  59. (5 rows)
  60. QUERY: SELECT '' AS five, q1, float8(q1) FROM INT8_TBL;
  61. five|              q1|float8              
  62. ----+----------------+--------------------
  63.     |             123|123                 
  64.     |             123|123                 
  65.     |4567890123456789|4.56789012345679e+15
  66.     |4567890123456789|4.56789012345679e+15
  67.     |4567890123456789|4.56789012345679e+15
  68. (5 rows)
  69. QUERY: SELECT '' AS five, q2, float8(q2) FROM INT8_TBL;
  70. five|               q2|float8               
  71. ----+-----------------+---------------------
  72.     |              456|456                  
  73.     | 4567890123456789|4.56789012345679e+15 
  74.     |              123|123                  
  75.     | 4567890123456789|4.56789012345679e+15 
  76.     |-4567890123456789|-4.56789012345679e+15
  77. (5 rows)
  78. QUERY: SELECT '' AS five, q1, int8(float8(q1)) AS "two coercions" FROM INT8_TBL;
  79. five|              q1|   two coercions
  80. ----+----------------+----------------
  81.     |             123|             123
  82.     |             123|             123
  83.     |4567890123456789|4567890123456789
  84.     |4567890123456789|4567890123456789
  85.     |4567890123456789|4567890123456789
  86. (5 rows)
  87. QUERY: SELECT '' AS five, 2 * q1 AS "twice int4" FROM INT8_TBL;
  88. five|      twice int4
  89. ----+----------------
  90.     |             246
  91.     |             246
  92.     |9135780246913578
  93.     |9135780246913578
  94.     |9135780246913578
  95. (5 rows)
  96. QUERY: SELECT '' AS five, q1 * 2 AS "twice int4" FROM INT8_TBL;
  97. five|      twice int4
  98. ----+----------------
  99.     |             246
  100.     |             246
  101.     |9135780246913578
  102.     |9135780246913578
  103.     |9135780246913578
  104. (5 rows)