circle.out
上传用户:blenddy
上传日期:2007-01-07
资源大小:6495k
文件大小:2k
- QUERY: CREATE TABLE CIRCLE_TBL (f1 circle);
- QUERY: INSERT INTO CIRCLE_TBL VALUES ('<(0,0),3>');
- QUERY: INSERT INTO CIRCLE_TBL VALUES ('<(1,2),100>');
- QUERY: INSERT INTO CIRCLE_TBL VALUES ('1,3,5');
- QUERY: INSERT INTO CIRCLE_TBL VALUES ('((1,2),3)');
- QUERY: INSERT INTO CIRCLE_TBL VALUES ('<(100,200),10>');
- QUERY: INSERT INTO CIRCLE_TBL VALUES ('<(100,0),100>');
- QUERY: INSERT INTO CIRCLE_TBL VALUES ('<(-100,0),-100>');
- ERROR: Bad circle external representation '<(-100,0),-100>'
- QUERY: INSERT INTO CIRCLE_TBL VALUES ('1abc,3,5');
- ERROR: Bad circle external representation '1abc,3,5'
- QUERY: INSERT INTO CIRCLE_TBL VALUES ('(3,(1,2),3)');
- ERROR: Bad circle external representation '(3,(1,2),3)'
- QUERY: SELECT * FROM CIRCLE_TBL;
- f1
- --------------
- <(0,0),3>
- <(1,2),100>
- <(1,3),5>
- <(1,2),3>
- <(100,200),10>
- <(100,0),100>
- (6 rows)
- QUERY: SELECT '' AS six, center(f1) AS center
- FROM CIRCLE_TBL;
- six|center
- ---+---------
- |(0,0)
- |(1,2)
- |(1,3)
- |(1,2)
- |(100,200)
- |(100,0)
- (6 rows)
- QUERY: SELECT '' AS six, radius(f1) AS radius
- FROM CIRCLE_TBL;
- six|radius
- ---+------
- | 3
- | 100
- | 5
- | 3
- | 10
- | 100
- (6 rows)
- QUERY: SELECT '' AS six, diameter(f1) AS diameter
- FROM CIRCLE_TBL;
- six|diameter
- ---+--------
- | 6
- | 200
- | 10
- | 6
- | 20
- | 200
- (6 rows)
- QUERY: SELECT '' AS two, f1 FROM CIRCLE_TBL WHERE radius(f1) < 5;
- two|f1
- ---+---------
- |<(0,0),3>
- |<(1,2),3>
- (2 rows)
- QUERY: SELECT '' AS four, f1 FROM CIRCLE_TBL WHERE diameter(f1) >= 10;
- four|f1
- ----+--------------
- |<(1,2),100>
- |<(1,3),5>
- |<(100,200),10>
- |<(100,0),100>
- (4 rows)
- QUERY: SELECT '' as five, c1.f1 AS one, c2.f1 AS two, (c1.f1 <-> c2.f1) AS distance
- FROM CIRCLE_TBL c1, CIRCLE_TBL c2
- WHERE (c1.f1 < c2.f1) AND ((c1.f1 <-> c2.f1) > 0)
- ORDER BY distance, one, two;
- five|one |two | distance
- ----+--------------+--------------+----------------
- |<(100,200),10>|<(100,0),100> | 90
- |<(100,200),10>|<(1,2),100> |111.370729772479
- |<(1,3),5> |<(100,200),10>|205.476756144497
- |<(1,2),3> |<(100,200),10>|208.370729772479
- |<(0,0),3> |<(100,200),10>|210.606797749979
- (5 rows)