home *** CD-ROM | disk | FTP | other *** search
- /*
- * $Header: /private/postgres/demo/RCS/set-up-1.temp,v 1.11 1992/07/23 05:05:37 mer Exp $
- * script to set up the demo database
- */
-
- create person (name = char16, age = int4, location = point)
- \g
- create emp (salary = int4, manager = char16) inherits (person)
- \g
- create student (gpa = float8) inherits (person)
- \g
- create stud_emp (percent = int4) inherits (emp, student)
- \g
- define type city_budget ( internallength = 16,
- input = int44in,
- output = int44out,
- element = int4)
- \g
-
- create city (name = char16, location = box, budget = city_budget)
- \g
-
- define function circle_in ( language = "c",
- returntype = circle )
- arg is (char16)
- as "_CWD_/circle.o"
- \g
-
- define function circle_out ( language = "c",
- returntype = char16 )
- arg is (circle)
- as "_CWD_/circle.o"
- \g
- define function pt_in_circle ( language = "c",
- returntype = bool)
- arg is (point, circle)
- as "_CWD_/circle.o"
- \g
-
- define function overpaid ( language = "c",
- returntype = bool)
- arg is (emp)
- as "_CWD_/overpaid.o"
- \g
- define type circle (internallength = 24,
- input = circle_in,
- output = circle_out)
- \g
-
- define function boxarea ( language = "c",
- returntype = int4)
- arg is (box)
- as "_CWD_/boxarea.o"
- \g
- load "_CWD_/boxarea.o"
- \g
- load "_CWD_/circle.o"
- \g
- load "_CWD_/overpaid.o"
- \g
-
- append person (name = "mike", age = 40, location = "(3.1,6.2)")
- \g
-
- append person (name = "joe", age = 20, location = "(5.5,2.5)")
- \g
-
- append person (name = "greg", age = 50, location = "(5.0,2.0)")
- \g
-
- append person (name = "bob", age = 18, location = "(0.0,0.0)")
- \g
-
- append emp (name = "bill", age = 20,
- location = "(11.0,10.0)", salary = 1000, manager = "sharon")
- \g
-
- append emp (name = "sharon", age = 25,
- location = "(15.0,12.0)", salary = 500, manager = "sam")
- \g
-
- append emp (name = "sam", age = 30,
- location = "(10.0,5.0)", salary = 300, manager = "bill")
- \g
-
- append student (name = "fred", age = 28, location = "(3.1,-1.5)", gpa = 3.7)
- \g
-
- append student (name = "larry", age = 60, location = "(21.8,4.9)", gpa = 3.1)
- \g
-
- append stud_emp (name = "jeff", age = 23,
- location = "(8.0,7.7)", salary = 600, manager = "sharon", gpa = 3.5)
- \g
-
- append stud_emp (name = "cim", age = 30, location = "(10.5,4.7)", salary = 400, gpa = 3.4)
- \g
-
- append stud_emp (name = "linda", age = 19, location = "(0.9,6.1)", salary = 100, gpa = 2.9)
- \g
-
-
- append city (name = "berkeley", location = "(0.0,0.0,10.0,10.0)",
- budget = "250, 300, 325, 275")
- \g
-
- append city (name = "oakland", location = "(-10.0,-10.0,0.0,5.0)",
- budget = "600, 400, 350, 500")
- \g
-
- append city (name = "elcerrito", location = "(10.0,0.0, 20.0,10.0)",
- budget = "100, 100, 100, 100")
- \g
-
- append city (name = "richmond", location = "(20.0,5.0, 35.0,15.0)",
- budget = "300, 320, 340, 360")
- \g
-
- append city (name = "sanpablo", location = "(35.0,20.0,40.0,30.0)",
- budget = "50, 60, 65, 70")
- \g
-
-