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.

Creating a Table (Transactions)Column Name Type Size Other Information and Notespatron_id NUMBER Primary Key. (Unique patron ID number, withvalues to be created using a sequence that youwill create)last_name VARCHAR2 30 Not Nullfirst_name VARCHAR2 30street_address VARCHAR2 30city_state_zip VARCHAR2 30The last column in the table (location) requires a complex data type, for which youmust use the Columns tab with advanced options. Check Show Advanced Options(next to Schema). This displays additional tabs for more table options.On the Columns tab, click the city_state_zip column name, and click the Add Column(+) icon to add the following as the last column in the table.Column Name Type Other Information and NoteslocationComplex typeSchema: MDSYSType: SDO_GEOMETRY(<strong>Oracle</strong> Spatial geometry object representing thepatron’s geocoded address)After you have entered the last column (location), click OK to finish creating the table.Go to Creating a Table (Transactions) to create the next table.Related TopicsTutorial: Creating Objects for a Small Database<strong>SQL</strong> <strong>Developer</strong> User Interface2.3 Creating a Table (Transactions)The Transactions table contains a row for each transaction involving a patron and abook (for example, someone checking a book out or returning a book). It includes twoforeign key columns. You will use the Create Table dialog box to create the tabledeclaratively; the table that you create will be essentially the same as if you hadentered the following statement using the <strong>SQL</strong> Worksheet:CREATE TABLE Transactions (transaction_id NUMBER PRIMARY KEY,patron_id CONSTRAINT for_key_patron_idREFERENCES patrons(patron_id),book_id CONSTRAINT for_key_book_idREFERENCES books(book_id),transaction_date DATE,transaction_type NUMBER);To create the Transactions table, if you are not already connected, connect to thedatabase as the user for the schema you are using for this tutorial. Right-click theTables node in the schema hierarchy on the left side, select Create Table, 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 table.2-4 <strong>SQL</strong> <strong>Developer</strong> Online Help

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

Saved successfully!

Ooh no, something went wrong!