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