• No results found

datalab Databases

N/A
N/A
Protected

Academic year: 2022

Share "datalab Databases"

Copied!
39
0
0

Loading.... (view fulltext now)

Full text

(1)

Databases

09. Oracle SQL Developer

2018. Fall

Instructor: Joonho Kwon

[email protected]

Data Science Lab @ PNU

(2)

⚫ Oracle has released the free SQL Developer tool (formerly known as Project Raptor) and it is

super!

If you have ever used the Free Toad tool or PL/SQL Developer this tool will feel familiar; plus it has more features and supports Oracle 10g too!

⚫ SQL Developer is a Java-based GUI tool (works in Windows, Unix, and Linux)

Oracle SQL Developer (1/2)

2

(3)

Power of SQL*Plus without a local Oracle client installation

Intuitive software; not completely new, based upon JDeveloper

Provides features often found only in expensive third-party software including:

GUI browsing of database objects, creation, deletion, alteration

Debugging complete with breakpoints

Query execution

Database reporting

Multiple connections

Oracle SQL Developer (2/2)

(4)

⚫ Oracle SQL Developer is a client application that can be used to access the Oracle database server

⚫ Go to

http://www.oracle.com/technetwork/developer- tools/sql-developer/downloads/index.html

Install Oracle SQL Developer (1/2)

4

(5)

Download SQL Developer 4.13

Windows 32/64-bit

Install Oracle SQL Developer (2/2)

(6)

⚫ 1. Extract SQL Developer

E.g.) C:\sqldeveloper

⚫ 2. Change the language of SQLDevelpoer

File: sqldeveloper.conf

location: C:\sqldeveloper\sqldeveloper\bin

Add followings

Run SQL Developer (1/2)

66

# Change the language

AddVMOption -Duser.language=en

AddVMOption -Duser.country=US

(7)

⚫ 3. Double click sqldeveloper

Under C:\sqldeveloper directory

⚫ 4. Specify the JDK home

Needed when you choose SQLDeveloper without JDK

E.g) C:\Program Files\Java\jdk1.8.0_73\

Run SQL Developer (2/2)

(8)

SQL Developer: Start Page

8

(9)

⚫ Click “new connection” button one the left-top.

Create New connection

(10)

1. Connection for Oracle XE 11g

10

(11)

⚫ Setting for Oracle XE

Connection Name(접속이름)

XE (anything will be fine)

Username: hr

password: oracle

Hostname: localhost

Port number: 1521

Oracle SID: xe

Connection for Oracle XE (1/4)

(12)

⚫ Click Test first and save

Connection for Oracle XE (2/4)

12

(13)

⚫ Check the connection name

Connection for Oracle XE (3/4)

(14)

⚫ then click connect

Connection for Oracle XE (4/4)

14

(15)

⚫ After logging in to a connection, SQL Developer shows three subpanels:

SQL developer

SQL Worksheet

(16)

⚫ The SQL Worksheet area has a dialog box where SQL may be keyed, viewed, and modified

SQL Worksheet

16

Note the “pull-down” showing the Connection that will be used to execute any SQL, PL/SQL, or script in the Worksheet

(17)

⚫ Type the following SQL

Type SQL

SELECT * FROM departments;

(18)

⚫ SQL Toolbar

Run Statement (Ctrl+Enter)

Run Script (F5)

Explain Plan (F10)

Auto Trace (F6)

Commit (F11)

Rollback (F12)

Clear (Ctrl+D)

SQL History (F9)

SQL Toolbars

18

(19)

⚫ Run Statement

If only one statement is in SQL Worksheet, select “Run Statement ”

⚫ Run Script (F5)

If more than one statement is coded, position the cursor in the statement to be executed (or highlight the statement), then select “Run Script”

Execute Statement

(20)

⚫ Click Run button

The “Results” tab shows the results of a single- statement execution

Statement Execution Results

20

(21)

⚫ If multiple SQL, PL/SQL, or script statements are to be executed together, select “Run Script”

⚫ Results show up in the “Script Output” tab

Run Script

(22)

⚫ When a script is executed, the results show up in the “Script Output” tab

Script Output

22

(23)

⚫ CREATE

⚫ INSERT

⚫ SELECT

Test the following SQL statements

(24)

Practice1: CREATE Table (1/2)

24

CREATE TABLE EMP

(EMPNO NUMBER(4) NOT NULL, ENAME VARCHAR2(10),

JOB VARCHAR2(9), MGR NUMBER(4), HIREDATE DATE, SAL NUMBER(7, 2),

COMM NUMBER(7, 2),

DEPTNO NUMBER(2));

(25)

⚫ Run Script

Practice1: CREATE Table (2/2)

(26)

⚫ Browsing the tree view:

if EMP does not appear,

right click Tables and select refresh

Double click EMP

Checking a table

26

(27)

⚫ Multiple Insert Statements

Pracetice2: Insert into a table (1/3)

INSERT INTO EMP VALUES

(7369, 'SMITH', 'CLERK', 7902,

TO_DATE('17-DEC-1980', 'DD-MON-YYYY'), 800, NULL, 20);

INSERT INTO EMP VALUES

(7499, 'ALLEN', 'SALESMAN', 7698,

TO_DATE('20-FEB-1981', 'DD-MON-YYYY'), 1600, 300, 30);

INSERT INTO EMP VALUES

(7521, 'WARD', 'SALESMAN', 7698,

TO_DATE('22-FEB-1981', 'DD-MON-YYYY'), 1250, 500, 30);

INSERT INTO EMP VALUES

(7566, 'JONES', 'MANAGER', 7839,

TO_DATE('2-APR-1981', 'DD-MON-YYYY'), 2975, NULL, 20);

INSERT INTO EMP VALUES

(7654, 'MARTIN', 'SALESMAN', 7698,

(28)

Pracetice2: Insert into a table (2/3)

28

INSERT INTO EMP VALUES

(7788, 'SCOTT', 'ANALYST', 7566,

TO_DATE('09-DEC-1982', 'DD-MON-YYYY'), 3000, NULL, 20);

INSERT INTO EMP VALUES

(7839, 'KING', 'PRESIDENT', NULL,

TO_DATE('17-NOV-1981', 'DD-MON-YYYY'), 5000, NULL, 10);

INSERT INTO EMP VALUES

(7844, 'TURNER', 'SALESMAN', 7698,

TO_DATE('8-SEP-1981', 'DD-MON-YYYY'), 1500, 0, 30);

INSERT INTO EMP VALUES

(7876, 'ADAMS', 'CLERK', 7788,

TO_DATE('12-JAN-1983', 'DD-MON-YYYY'), 1100, NULL, 20);

INSERT INTO EMP VALUES

(7900, 'JAMES', 'CLERK', 7698,

TO_DATE('3-DEC-1981', 'DD-MON-YYYY'), 950, NULL, 30);

INSERT INTO EMP VALUES

(7902, 'FORD', 'ANALYST', 7566,

TO_DATE('3-DEC-1981', 'DD-MON-YYYY'), 3000, NULL, 20);

INSERT INTO EMP VALUES

(7934, 'MILLER', 'CLERK', 7782,

TO_DATE('23-JAN-1982', 'DD-MON-YYYY'), 1300, NULL, 10);

(29)

⚫ Run Script

Insert into a table (3/3)

(30)

⚫ Click Run

Practice3: SELECT (1/2)

30

SELECT * FROM EMP;

(31)

Practice3: SELECT (2/2)

(32)

2. Connection for DataLab’s Oracle

32

(33)

⚫ Setting for Oracle Server @ DataLab

Connection Name(접속이름)

DataLab (anything will be fine)

DB username, DB password

Will be posted at the class web site

Hostname: 164.125.37.214

Port number: 1521

Create New connection for DataLab (1/4)

(34)

Create New connection for DataLab (2/4)

34

⚫ Click Test first and save

(35)

⚫ Check the connection name

Create New connection for DataLab (3/4)

(36)

Create New connection for DataLab (4/4)

36

⚫ then click connect

(37)

⚫ The SQL Worksheet area has a dialog box where SQL may be keyed, viewed, and modified

SQL Worksheet

Note the “pull-down” showing the Connection that will be used to execute any SQL, PL/SQL, or script in the Worksheet

(38)

⚫ CREATE

⚫ INSERT

⚫ SELECT

Test the following SQL statements

38

(39)

Q&A

References

Related documents

Rosenblum, in testimony before the Committee on Homeland Security, Subcommittee on Border and Maritime Security on February 26, 2013, stated that the United States has spent

Now, companies can get a clear view of their workforce with a single system of record in the cloud, such as SuccessFactors’ Employee Central.. Core HR in the cloud not only

Oracle SQL Developer, as mentioned earlier, was designed as a development tool for the single developer; it provides minimal abilities to share things with other developers; these

Provides conceptual and usage information about Oracle SQL Developer, a graphical tool that enables you to browse, create, edit, and delete (drop) database objects; run SQL

Using Oracle SQL Developer and SQL Developer Data Modeler to aid your Oracle Application Express development.. Marc Sewtz | Software Development Manager | Oracle

Kurt már így is figyelemre méltó gyakorisággal került az Egyesült Királyság médiájának címlapjaira, ez a közlése azonban nagyobb figyelmet szerzett neki, mint bármi,

Pyopkfjhjfw Pyopkfjhjfw jf lh Bhzfykh jf lh Bhzfykh Pyopkfjhjfw Pyopkfjhjfw ftzfcwk}hw o ftzfcwk}hw o nfcfyhlfw nfcfyhlfw " Woc hxvfllhw xvf " Woc hxvfllhw xvf }hyâhc

Purdue University, Krannert School of Management, Strategic Management Seminar (2005) SMU, Cox School of Business, Strategy and Entrepreneurship Seminar (2004). Tilburg