12.07.2015 Views

Oracle SQL Developer

Oracle SQL Developer

Oracle SQL Developer

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Script for Creating and Using the Library Tutorial ObjectsClick the Execute <strong>SQL</strong> Statement icon in the <strong>SQL</strong> Worksheet toolbar, and view theresults of the query.Click the Execute Explain Plan icon in the <strong>SQL</strong> Worksheet toolbar to see the executionplan (displayed on the Explain tab) that <strong>Oracle</strong> Database follows to execute the <strong>SQL</strong>statement. The information includes the optimizer strategy and the cost of executingthe statement. (For information about how to generate and interpret execution plans,see <strong>Oracle</strong> Database Performance Tuning Guide.)Related TopicsTutorial: Creating Objects for a Small DatabaseUsing the <strong>SQL</strong> Worksheet2.9 Script for Creating and Using the Library Tutorial ObjectsThe following statements create and use the database objects that you have created (orwill create) in Tutorial: Creating Objects for a Small Database. You can view thesecommands to help you understand the library database objects that are covered in thetutorial.-- Clean up from any previous runningDROP TABLE transactions;DROP TABLE books;DROP TABLE patrons;DROP SEQUENCE patron_id_seq;DROP SEQUENCE trans_id_seq;DROP VIEW patrons_trans_view;set serveroutput on-- Create objectsCREATE TABLE Books (book_id VARCHAR2(20) PRIMARY KEY,title VARCHAR2(50)CONSTRAINT title_not_null NOT NULL,author_last_name VARCHAR2(30)CONSTRAINT last_name_not_null NOT NULL,author_first_name VARCHAR2(30),rating NUMBER,CONSTRAINT rating_1_to_10 CHECK (rating IS NULL OR(rating >= 1 and rating

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

Saved successfully!

Ooh no, something went wrong!