1 / 8

4. Oracle SQL

4. Oracle SQL. SQL. DDL Data Definition Language ( 資料定義語言 ) DML Data Manipulation Language ( 資料處理語言 ). DDL. Example. SQL*Plus. SQL> connect teacher/oracle@210.240.223.171 SQL> create table b (colb char(1)); SQL> drop table b; SQL> create table state

abe
Télécharger la présentation

4. Oracle SQL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 4. Oracle SQL

  2. SQL • DDL • Data Definition Language (資料定義語言) • DML • Data Manipulation Language (資料處理語言)

  3. DDL

  4. Example • SQL*Plus SQL> connect teacher/oracle@210.240.223.171 SQL> create table b (colb char(1)); SQL> drop table b; SQL> create table state 2 (state_cd char(2) not null, 3 state_name varchar2(20)); SQL> desc state; 連結資料庫 分號是命令的結束強迫執行 或者在新行用 / 分行會自動出現行數 Describe用來顯示資料表細節

  5. Exercise (練習) • P.2-8~p.2-10 • HR範例

  6. DML • Select • 檢索資料表 • Insert • 新增資料 • Update • 修改資料 • Delete • 刪除資料

  7. Example • Insert • Delete • Update SQL> INSERT INTO employees (employee_id, last_name, email, hire_date, job_id, salary) VALUES (11, 'Doe', 'jane.doe', '31-AUG-05', 'SH_CLERK', 2400); SQL> DELETE FROM employees WHERE employee_id = 10 OR employee_id = 11; SQL> UPDATE employees SET salary = salary * 1.05 WHERE employee_id = 11;

  8. Example • select SQL> SELECT * FROM employees; SQL> SELECT employee_id, last_name, first_name FROM employees; SQL> SELECT * FROM employees WHERE manager_id = 122; SQL> SELECT * FROM employees WHERE manager_id = 122 AND job_id = 'ST_CLERK‘; SQL> SELECT employee_id, last_name FROM employees WHERE last_name LIKE '%mar%‘; SQL> SELECT employee_id, last_name FROM employees WHERE commission_pct IS NOT NULL; SQL> SELECT employee_id, last_name, first_name FROM employees WHERE employee_id IN (125, 130, 135);

More Related