chapter2 thai 5-rev1

Upload: ake-thcitizen

Post on 29-May-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/9/2019 Chapter2 Thai 5-Rev1

    1/20

    Copyright 2007, Oracle. All rights reserved.

    SQL Developer

  • 8/9/2019 Chapter2 Thai 5-Rev1

    2/20

    Copyright 2007, Oracle. All rights reserved.2 - 2

    Using SQL*Plus and iSQL*Plus toAccess Your Database

    SQL*Plus and provide a command-line interface toyour database, thereby enabling you to:

    Perform database management operations

    Execute SQL commands to query, insert, update,and delete data in your database

  • 8/9/2019 Chapter2 Thai 5-Rev1

    3/20

    Copyright 2007, Oracle. All rights reserved.2 - 3

    SQL and SQL*Plus Interaction

    Server

    SQL statements

    Query results

    SQL*Plus

  • 8/9/2019 Chapter2 Thai 5-Rev1

    4/20

    Copyright 2007, Oracle. All rights reserved.2 - 4

    Logging In to SQL*Plus

  • 8/9/2019 Chapter2 Thai 5-Rev1

    5/20

    Copyright 2007, Oracle. All rights reserved.2 - 5

    Displaying Table Structure

    Name Null? Type

    ----------------------- -------- ------------

    DEPARTMENT_ID NOT NULL NUMBER(4)

    DEPARTMENT_NAME NOT NULL VARCHAR2(30)

    MANAGER_ID NUMBER(6)

    LOCATION_ID NUMBER(4)

    DESCRIBE departments

  • 8/9/2019 Chapter2 Thai 5-Rev1

    6/20

    Copyright 2007, Oracle. All rights reserved.2 - 6

    What Is Oracle SQL Developer?

    Oracle SQL Developer is a graphical tool that enhancesproductivity and simplifies database developmenttasks.

    You can connect to any target Oracle database schemaby using standard Oracle database authentication.

    SQL Developer

  • 8/9/2019 Chapter2 Thai 5-Rev1

    7/20Copyright 2007, Oracle. All rights reserved.2 - 7

    Specifications of SQL Developer

    Developed in Java Supports Windows, Linux, and Mac OS X platforms

    Default connectivity by using the JDBC Thin driver

    Does not require an installer

    Unzip the downloaded SQL Developer kit and double-click sqldeveloper.exe to start SQL Developer.

    Connects to Oracle Database version 9.2.0.1 and later

    Freely downloadable from the following link:

    http://www.oracle.com/technology/products/database/sql

    _developer/index.html Needs JDK 1.5 installed on your system that can be

    downloaded from the following link:

    http://java.sun.com/javase/downloads/index_jdk5.jsp

    http://www.oracle.com/technology/products/database/sql_developer/index.htmlhttp://www.oracle.com/technology/products/database/sql_developer/index.htmlhttp://java.sun.com/javase/downloads/index_jdk5.jsphttp://java.sun.com/javase/downloads/index_jdk5.jsphttp://www.oracle.com/technology/products/database/sql_developer/index.htmlhttp://www.oracle.com/technology/products/database/sql_developer/index.html
  • 8/9/2019 Chapter2 Thai 5-Rev1

    8/20Copyright 2007, Oracle. All rights reserved.2 - 8

    Installing SQL Developer

    Download the Oracle SQL Developer kit and unzip into anydirectory on your machine.

  • 8/9/2019 Chapter2 Thai 5-Rev1

    9/20Copyright 2007, Oracle. All rights reserved.2 - 9

    SQL Developer Interface

    You must define aconnection to start

    using SQL Developerfor running SQL querieson a database schema.

  • 8/9/2019 Chapter2 Thai 5-Rev1

    10/20Copyright 2007, Oracle. All rights reserved.2 - 1 0

    Creating a Database Connection

    You must have at least one database connection to useSQL Developer.

    You can create and test connections:

    For multiple databases

    For multiple schemas

    Each additional database connection created is listedin the Connections Navigator hierarchy.

  • 8/9/2019 Chapter2 Thai 5-Rev1

    11/20Copyright 2007, Oracle. All rights reserved.2 - 11

    Creating a Database Connection

    1

    2

    3

  • 8/9/2019 Chapter2 Thai 5-Rev1

    12/20Copyright 2007, Oracle. All rights reserved.2 - 1 3

    Browsing Database Objects

    Use the Connections Navigator to: Browse through many objects in a database schema

    Review the definitions of objects at a glance

  • 8/9/2019 Chapter2 Thai 5-Rev1

    13/20Copyright 2007, Oracle. All rights reserved.2 - 1 4

    Using the SQL Worksheet

    Use the SQL Worksheet to enter and execute SQL,PL/SQL, and SQL*Plus statements.

    Specify any actions that can be processed by thedatabase connection associated with the worksheet.

    Enter SQLstatements.

    Results areshown here.

  • 8/9/2019 Chapter2 Thai 5-Rev1

    14/20Copyright 2007, Oracle. All rights reserved.2 - 1 5

    Using the SQL Worksheet

    1 2

    3

    4

    5

    6

    7

    8 9

  • 8/9/2019 Chapter2 Thai 5-Rev1

    15/20Copyright 2007, Oracle. All rights reserved.2 - 1 7

    Executing SQL Statements

    Use the Enter SQL Statement box to enter single ormultiple SQL statements.

    F9 F5

    F9

    F5

  • 8/9/2019 Chapter2 Thai 5-Rev1

    16/20Copyright 2007, Oracle. All rights reserved.2 - 1 8

    Formatting the SQL Code

    Beforeformatting

    Afterformatting

  • 8/9/2019 Chapter2 Thai 5-Rev1

    17/20Copyright 2007, Oracle. All rights reserved.2 - 1 9

    Saving SQL Statements

    1

    23

  • 8/9/2019 Chapter2 Thai 5-Rev1

    18/20Copyright 2007, Oracle. All rights reserved.2 - 2 0

    Running Script Files

    1

    2

    3

  • 8/9/2019 Chapter2 Thai 5-Rev1

    19/20Copyright 2007, Oracle. All rights reserved.2 - 2 1

    Setting Preferences

    Customize the SQL Developer interface andenvironment.

    In the Tools menu, select Preferences.

  • 8/9/2019 Chapter2 Thai 5-Rev1

    20/20

    Workshop : Overview

    5.1 5.4 SQL Plus SQL Developer SQL 80