Originally posted by fahrvergnuugen
create view is not a standard sql command. sounds like some sort of proprietary microsoft jargon.
Horse puckies.
It's SQL-92.
Here's the chapter on it:
11.19 <view definition>
11.19 <view definition>
Function
Define a viewed table.
Format
<view definition> ::=
CREATE VIEW <table name> [ <left paren> <view column list>
<right paren> ]
AS <query expression>
[ WITH [ <levels clause> ] CHECK OPTION ]
<levels clause> ::=
CASCADED | LOCAL
<view column list> ::= <column name list>
Syntax Rules
1) The <query expression> shall not contain a <target specifica-
tion> or a <dynamic parameter specification>.
2) If a <view definition> is contained in a <schema definition>
and the <table name> contains a <schema name>, then that <schema
name> shall be the same as the specified or implicit <schema
name> of the containing <schema definition>.
3) The schema identified by the explicit or implicit schema name
of the <table name> shall not include a table descriptor whose
table name is <table name>.
4) The viewed table defined by <view definition> shall not be
identified by any <table reference> generally contained in the
<query expression>.
5) Any <table name> that is specified in the <query expression>
shall be different from the <table name> of any <temporary table
declaration>.
6) If the <query expression> is updatable, then the viewed table is
an updatable table. Otherwise, it is a read-only table.
7) If the <query expression> is a <query specification> that con-
tains a <group by clause> or a <having clause> that is not con-
tained in a <subquery>, then the viewed table defined by the
<view definition> is a grouped view.
8) If any two columns in the table specified by the <query ex-
pression> have the same <column name>, or if any column of that
table has an implementation-dependent name, then a <view column
list> shall be specified.
296 Database Language SQL
X3H2-92-154/DBL CBR-002
11.19 <view definition>
9) The same <column name> shall not be specified more than once in
the <view column list>.
10)The number of <column name>s in the <view column list> shall
be the same as the degree of the table specified by the <query
expression>.
11)No column in the table specified by <query expression> shall
have a coercibility attribute of No collating sequence.
Note: The coercibility attribute is described in Subclause 4.2.3,
"Rules determining collating sequence usage".
Note: The coercibility attribute for references to the column is
defined in Subclause 6.4, "<column reference>".
12)If WITH CHECK OPTION is specified, then the viewed table shall
be updatable.
13)If WITH CHECK OPTION is specified with no <levels clause>, then
a <levels clause> of CASCADED is implicit.
14)Let V be the view defined by the <view definition>. The un-
derlying columns of every i-th column of V are the underlying
columns of the i-th column of the <query expression> and the
underlying columns of V are the underlying columns of the <query
expression>.
Maybe you should pick a database that doesn't suck so hard next time. 😉
You'll note the original poster didn't mention using an inferior product and having to work around it. In fact, he stated the challenge was to people who are "good with PHP and databases."
If he needs a "mysql" answer he should mention he's using it. If he needs a "database" answer, he got one, and one that works on just about any database currently available:
db2, oracle, postgresql, firebird, mssql, etc. etc.