This is a discussion on CREATE VIEW syntax for mySQL within the MySQL Database forums, part of the Database Forums category; I am trying the ANSI SQL syntax, like in the command below, but it raises a syntax error: CREATE VIEW ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I am trying the ANSI SQL syntax, like in the command below, but it
raises a syntax error: CREATE VIEW todays_expenses AS SELECT item, amount FROM my_expenses where date = curdate(); Three questions: a) What's the correct syntax? b) I am using mySQL version 4.1.22-community-nt. I can see an online manual for the same over here: http://dev.mysql.com/doc/refman/4.1/en/ However, I can't find a manual for mySQL specific syntax such as the scenario described above. Can you tell me where it is? c) What's the best book to buy for learning mySQL for a database programmer. I'll tell you my goals. I want a book that covers: 1) the theory behind operators (cartesian JOIN, cross JOIN, all the JOINs, UNION, UNION all) and their comparison to mathematics/set theory 2) writing complex queries, nested queries (sub-queries) 3) tell me about some mySQL hacks like how many maximum columns a table can have, if there's some such thing 4) explains what indexing is, types of indexing, types of locks, etc. 5) explains what database partitions are 6) explains some maintenance legwork like backup/restore, setting up ODBC connections, creating and deleting users, granting/revoking rights PS: ALL OF THIS OVER WINDOWS 7) teaches me to write stored procedures, cursors, functions, packages (if there's such a thing) and triggers 8) tells me about the limits of each datatype and possibly their internal structure (for instance, is the DECIMAL a floating pointing number really?) ************************************************** *************** And, specifically that does NOT waste time covering: ************************************************** *************** a) the tools and toys around mySQL and how to use them b) the differences in different versions I can get all of that stuff off the Internet easier than I can get the stuff I want. |
|
|||
|
On Wed, 17 Oct 2007 15:41:47 +0200, <Mukesh_Singh_Nick@yahoo.com> wrote:
> I am trying the ANSI SQL syntax, like in the command below, but it > raises a syntax error: > > CREATE VIEW todays_expenses AS > SELECT item, amount FROM my_expenses > where date = curdate(); > > Three questions: > > a) What's the correct syntax? The above works fine here, as long as the fields exist in the table. > b) I am using mySQL version 4.1.22-community-nt. I can see an online > manual for the same over here: > > http://dev.mysql.com/doc/refman/4.1/en/ > > However, I can't find a manual for mySQL specific syntax such as the > scenario described above. Can you tell me where it is? http://dev.mysql.com/doc/refman/5.0/en/views.html "Views (including updatable views) are implemented in MySQL Server 5.0. Views are available in binary releases from 5.0.1 and up." And for 'MySQL specific syntax', just referring to http://dev.mysql.com/doc/refman/4.1/en/sql-syntax.html does the trick. So either upgrade of find another solution then a view. > c) What's the best book to buy for learning mySQL for a database > programmer. I'll tell you my goals. I want a book that covers: Don't know, the SQL book I have is Joe Celko's Trees and Hierarchies book, which is definitely not written for MySQL itself.. -- Rik Wasmus |
|
|||
|
On Oct 17, 3:27 pm, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Wed, 17 Oct 2007 15:41:47 +0200, <Mukesh_Singh_N...@yahoo.com> wrote: > > I am trying the ANSI SQL syntax, like in the command below, but it > > raises a syntax error: > > > CREATE VIEW todays_expenses AS > > SELECT item, amount FROM my_expenses > > where date = curdate(); > > > Three questions: > > > a) What's the correct syntax? > > The above works fine here, as long as the fields exist in the table. > > > b) I am using mySQL version 4.1.22-community-nt. I can see an online > > manual for the same over here: > > >http://dev.mysql.com/doc/refman/4.1/en/ > > > However, I can't find a manual for mySQL specific syntax such as the > > scenario described above. Can you tell me where it is? > > http://dev.mysql.com/doc/refman/5.0/en/views.html > "Views (including updatable views) are implemented in MySQL Server 5.0. > Views are available in binary releases from 5.0.1 and up." > > And for 'MySQL specific syntax', just referring to http://dev.mysql.com/doc/refman/4.1/...yntax.htmldoes the trick. > > So either upgrade of find another solution then a view. > > > c) What's the best book to buy for learning mySQL for a database > > programmer. I'll tell you my goals. I want a book that covers: > > Don't know, the SQL book I have is Joe Celko's Trees and Hierarchies book, > which is definitely not written for MySQL itself.. > -- > Rik Wasmus Thanks, Rik. |
|
|||
|
Mukesh_Singh_Nick@yahoo.com wrote in news:1192628507.401151.265370
@k35g2000prh.googlegroups.com: > Three questions: > c) What's the best book to buy for learning mySQL for a database > programmer. I'll tell you my goals. I want a book that covers: May I humbly suggest Apress' "Pro MySQL": http://www.amazon.com/MySQL-Experts-...dp/159059505X/ It covers everything right down to the nuts and bolts of things you didn't even know you wanted to know about MySQL. Highly, highly recommended. Too bad I haven't read it all yet. |
|
|||
|
On Oct 17, 9:15 pm, Good Man <he...@letsgo.com> wrote:
> Mukesh_Singh_N...@yahoo.com wrote in news:1192628507.401151.265370 > @k35g2000prh.googlegroups.com: > > > Three questions: > > c) What's the best book to buy for learning mySQL for a database > > programmer. I'll tell you my goals. I want a book that covers: > > May I humbly suggest Apress' "Pro MySQL": > > http://www.amazon.com/MySQL-Experts-...dp/159059505X/ > > It covers everything right down to the nuts and bolts of things you didn't > even know you wanted to know about MySQL. > > Highly, highly recommended. Too bad I haven't read it all yet. Good Man, Read the book reviews at Amazon. I'm halfway looking through the Table of Contents at Amazon and I can't resist stopping myself to say thanks. It seems just like one of the books I need. |