Create View, Index

S

Sol

I need help in figuring out how to do the CREATE VIEW, CREATE INDEX function.
Here are some of the exercises I need to do:

Create a view named PenguinBooks. It consists of the book code, book title,
book type, and book price for every book published by Penguin USA. Display
the data in the view.

Create the following indexes.
Create an index named BookIndex1 on the PublisherName field in the
Publisher table.

I followed every rule possible, but came up empty.
An error message pops up rejecting the operation.
Any suggestions?
Sol
 
A

Allen Browne

Some of these depend on the library you use to execute the query, i.e. they
might work only if executed under ADO (not DAO.)

Here's an exmaple of how to create a view with ADO:
http://allenbrowne.com/func-ADO.html#CreateViewAdo
or with ADOX:
http://allenbrowne.com/func-ADOX.html#CreateViewAdox

Here are some examples of creating indexes and keys with ADOX:
http://allenbrowne.com/func-ADOX.html#CreateIndexesAdox
http://allenbrowne.com/func-ADOX.html#CreateKeyAdox

Finally, you can use the DAO object library to create a query (view or
procedure):
http://allenbrowne.com/func-DAO.html#CreateQueryDAO
or indexes:
http://allenbrowne.com/func-DAO.html#CreateIndexesDAO
 
S

Sol

Thank you Allen for your reply,

However, I was unable to solve the problem. If you can please be more
specific. I would appreciate it.

The following is the way I entered the syntax and got the error message:

CREATE VIEW PenguinBooks AS
SELECT BookCode, Title, Type, Price
FROM Book
WHERE PublisherCode=’PE’
;

Can you see what am I doing wrong, and how to correct it?

Thank you again,
Sol
 
A

Allen Browne

Did you do this as a string variable, and Execute it in ADO?

That's different than trying it in the interface.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top