Re: Column name in view

From: Tibor Karaszi <tibor_not_pressed_ham_.karaszi_at_cornerstone.se>
Date: Sun, 10 Nov 2002 10:00:59 GMT
Message-ID: <v7qz9.3251$h%5.119291_at_newsb.telia.net>


"--CELKO--" <71062.1056_at_compuserve.com> wrote in message news:c0d87ec0.0211091607.2d38b63f_at_posting.google.com...
> Put the column names into the VIEW declaration header, not the body of the
view.
>
> CREATE VIEW Foobar (id, name, study)
> AS SELECT a.studend_id, a.student_name, b.course_study
> FROM view1 AS a, View2 AS b
> WHERE a.student_id = b.student_id;

I think that the SELECT statement that K.Y. posted was going against the view, so it wasn't the view definition itself. I might have misunderstood of course.

Btw, I checked one of my SQL-99 books (*) which states that the column names that the view exposes should be that is the query in the view (if the column name list is omitted). So, if the SELECT statement indeed was the view definition, I'd say that the behavior is not ANSI SQL compliant. ((*) Gulutzan's and Perlzer's book - I had a few beer to many yesterday to read the ANSI docs right now. <g>)

Another possibility is that K.Y. is using some query tool which tries to "help" by using some meta-data and exposes "where the data comes from" with the column names.

--
Tibor Karaszi
Received on Sun Nov 10 2002 - 11:00:59 CET

Original text of this message