CREATE VIEW syntax for mySQL

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 ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-17-2007
Mukesh_Singh_Nick@yahoo.com
 
Posts: n/a
Default CREATE VIEW syntax for mySQL

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.

Reply With Quote
  #2 (permalink)  
Old 10-17-2007
Rik Wasmus
 
Posts: n/a
Default Re: CREATE VIEW syntax for mySQL

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
Reply With Quote
  #3 (permalink)  
Old 10-17-2007
Mukesh_Singh_Nick@yahoo.com
 
Posts: n/a
Default Re: CREATE VIEW syntax for mySQL

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.

Reply With Quote
  #4 (permalink)  
Old 10-17-2007
Good Man
 
Posts: n/a
Default Re: CREATE VIEW syntax for mySQL

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.

Reply With Quote
  #5 (permalink)  
Old 10-17-2007
Mukesh_Singh_Nick@yahoo.com
 
Posts: n/a
Default Re: CREATE VIEW syntax for mySQL

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.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:08 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0