home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / database / theory / 652 < prev    next >
Encoding:
Text File  |  1992-12-14  |  1.6 KB  |  42 lines

  1. Newsgroups: comp.databases.theory
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!daffy!uwvax!cs.wisc.edu!hellers
  3. From: hellers@cs.wisc.edu (Joe Hellerstein)
  4. Subject: Re: date -> day of week conversion
  5. In-Reply-To: csa09@seq1.keele.ac.uk's message of 14 Dec 92 16:03:11 GMT
  6. Message-ID: <HELLERS.92Dec14181850@cleo.cs.wisc.edu>
  7. Sender: news@cs.wisc.edu (The News)
  8. Organization: Univ. of Wisconsin @ Madison, CS Dept.
  9. References: <dtb.724154401@otto> <Bz9B9C.BBD@gabriel.keele.ac.uk>
  10. Date: Tue, 15 Dec 1992 00:18:50 GMT
  11. Lines: 29
  12.  
  13. In article <Bz9B9C.BBD@gabriel.keele.ac.uk> csa09@seq1.keele.ac.uk (Paul Singleton) writes:
  14.  
  15. >   > Rumor has it that one SQL based DB, Empress, running on UNIX and VMS,
  16. >   > permits you to define your own functions that can be embedded in the
  17. >   > sql, letting you define that function and then
  18. >   >     select surname, givname
  19. >   >     where    day_of_week(birthdate) = 'Saturday'
  20. >   >     from     emp;
  21. >
  22. >   OK so I can define a function for use in a join condition, but I really
  23. >   want to define a virtual table, some of whose columns are functions of
  24. >   other columns.  I can see that SQL syntax doesn't accommodate this concept,
  25. >   although I claim it is a reasonable thing to want to do.
  26.  
  27. If I read you right, all you want is a view, with a function in the
  28. select list, e.g.:
  29.  
  30. DEFINE VIEW function(domaintype fc1, rangetype fc2, ...) AS
  31.   (SELECT c1, f(c1), ...
  32.      FROM ...
  33.     WHERE ...   
  34.   ) ;
  35.  
  36. No?  This would be supported, for instance, in Starburst's version of
  37. SQL, or with similar syntax in POSTGRES' Postquel language.  And if
  38. Empress is as described above, I'd have to guess it would work there
  39. too.  No big tricks here.
  40.  
  41. Joe Hellerstein
  42.