12.07.2015 Views

Oracle SQL Developer

Oracle SQL Developer

Oracle SQL Developer

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Creating a View2.5 Creating a ViewClick OK to finish creating the sequence.To create a view, go to Creating a View.Related TopicsTutorial: Creating Objects for a Small Database<strong>SQL</strong> <strong>Developer</strong> User InterfaceCreate a view that returns information about patrons and their transactions. This viewqueries the Patrons and Transactions tables, and returns rows that contain a patron’sID, last name, and first name, along with a transaction and the transaction type. Therows are ordered by patron ID, and by transaction type within patron IDs.To create the patrons_trans_view view, if you are not already connected, connect to thedatabase as the user for the schema you are using for this tutorial. Right-click theViews node in the schema hierarchy on the left side, select Create View, and enter thefollowing information. (If a tab or field is not mentioned, do not enter anything for it.)Schema: Specify your current schema as the schema in which to create the view.Name: patrons_trans_viewEntire <strong>SQL</strong> Query tabIn the Entire <strong>SQL</strong> Query box, enter (or copy and paste) the following statement:SELECT p.patron_id, p.last_name, p.first_name,t.transaction_type, t.transaction_dateFROM patrons p, transactions tWHERE p.patron_id = t.patron_idORDER BY p.patron_id, t.transaction_typeThen click Test Syntax, and ensure that you have not made any syntax errors. If youmade any errors, correct then and click Test Syntax again.DDLReview the <strong>SQL</strong> statement that <strong>SQL</strong> <strong>Developer</strong> will use to create the view. If you wantto make any changes, go back to the Entire <strong>SQL</strong> Query tab and make the changesthere.If you want to save the CREATE VIEW statement to a <strong>SQL</strong> script file, click Save andspecify the location and file name.When you are finished, click OK.You have finished creating the view. To see the data returned by the view, in theConnections navigator, expand Views, select PATRONS_TRANS_VIEW, and click theData tab.Related TopicsTutorial: Creating Objects for a Small Database<strong>SQL</strong> <strong>Developer</strong> User InterfaceTutorial: Creating Objects for a Small Database 2-7

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!