SQL2-ch3 操控大型資料集.

Slides:



Advertisements
Similar presentations
SQL1-ch7 集合運算 1. 題號  80 題: 50 、 55 、 62  140 題: 41 、 61 、
Advertisements

SQL2-ch2 管理綱要物件.
Oracle Academy Egypt Virtual training week 8 Sections from 7 to 9.
Installment 7 Tables With No Column Presented by rexmen 2001 資管所.林彥廷.
SQL2-ch1 控制使用者存取. 題號  80 題: 14 、 22 、 40 、 42 、 52  140 題: 9 、 40 、 103.
SQL1-ch2 限制和排序資料. 考古題題號  80 題: 27 、 51  140 題: 23 、 58 、 70.
SQL1-ch11 使用資料說明視觀表 (Data Dictionary) 管理物件. 題號  80 題: 6 、 64  140 題: 105.
Chapter Four Parameter Estimation and Statistical Inference.
Divide-and-Conquer. 什麼是 divide-and-conquer ? Divide 就是把問題分割 Conquer 則是把答案結合起來.
Introduction to Java Programming Lecture 13 Classes I OO Programming.
: A-Sequence 星級 : ★★☆☆☆ 題組: Online-judge.uva.es PROBLEM SET Volume CIX 題號: Problem D : A-Sequence 解題者:薛祖淵 解題日期: 2006 年 2 月 21 日 題意:一開始先輸入一個.
“Rule” By OX. By Check CREATE TABLE 員工薪資 ( 編號 int IDENTITY PRIMARY KEY, 薪資 smallmoney, CHECK ( 薪資 > 0 AND 薪資
Instructor: Ching-Chi Lin 林清池 助理教授
如何將數字變成可用之資訊 現代化資料處理與應用概念. 如何將數字變成可用之資訊 人最容易接受的訊息是圖像化資訊。 在一堆數字中,要進行比較分析,一般會使用表格形 式計算與分析。 所以一般我們會將數字依關聯性, 轉換成表格計算與分析。 此表格一般稱試算表或稱表格。 再將結果轉換為圖表,進行比較與分析。
BY OX. 檢視表與資料表的差異性 查詢 (query) 檢視表 (View) 的紀錄,是經由查詢 (query) 而來,而檢 視表的資料來源可以是單一資料表或是多資料表,甚 至其他檢視表 但檢視表中的紀錄只存在資料表中.
1 第一章 Word 的基本觀念 內容概要: Word 的特色 啟動與離開 Word 的方法 滑鼠游標與外型的介紹 基本操作 Word 視窗法則 使用 Word 遭遇問題時, 應如何利用軟體特 性而獲得輔助解說.
: Determine it 星等:★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 10520: Determine it 解題者:林祺光 解題日期: 2006 年 5 月 22 日 題意:給兩個值 a 1,n 和 n a i,j.
Last modified 2004/02 An Introduction to SQL (Structured Query Language )
McGraw-Hill/Irwin © 2003 The McGraw-Hill Companies, Inc.,All Rights Reserved. 肆 資料分析與表達.
8.1 何謂高度平衡二元搜尋樹 8.2 高度平衡二元搜尋樹的加入 8.3 高度平衡二元搜尋樹的刪除
SQL 介紹 視觀、序列、同義詞、索引.
第 1 章 PC 的基本構造. 本章提要 PC 系統簡介 80x86 系列 CPU 及其暫存器群 記憶體: Memory 80x86 的分節式記憶體管理 80x86 的 I/O 結構 學習組合語言的基本工具.
資源整合查詢系統. (2) 找尋資料時面臨的問題 1. 如何取得檢索結果的全文或相關資料 ? Ex: GoogleScholar, ISI SCI? 2. 如何看到參考文獻 (Citation, Reference) 的全文 ? 3. 該從那個資料庫開始查 ? 4. 如何分類儲存查詢結果 ? 5.
8 Copyright © Oracle Corporation, All rights reserved. Manipulating Data.
: Ahoy, Pirates! ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11402: Ahoy, Pirates! 解題者:李重儀 解題日期: 2008 年 8 月 26 日 題意:有一個海盜島有 N 個海盜,他們的編號 (id)
國立聯合大學 資訊管理學系 陳士杰老師 SQL*Plus 與 iSQL*Plus 簡介. 國立聯合大學 資訊管理學系 資料庫系統課程 ( 陳士杰 ) 2 啟動 SQL*Plus 與 iSQL*Plus 方式 Windows 平台.
從此處輸入帳號密碼登入到管理頁面. 點選進到檔案管理 點選「上傳檔案」上傳資料 點選瀏覽選擇電腦裡的檔案 可選擇公開或不公開 為平台上的資料夾 此處為檔案分類,可顯示在展示頁面上,若要參加 MY EG 競賽,做品一律上傳到 “ 98 MY EG Contest ” 點選此處確定上傳檔案.
6-2 認識元件庫與內建元件庫 Flash 的元件庫分兩種, 一種是每個動畫專 屬的元件庫 (Library) ;另一種則是內建元 件庫 (Common Libraries), 兩者皆可透過 『視窗』功能表來開啟, 以下即為您說明。
Deletion in MIN-MAX Heaps Delete min element Delete max element.
: A-Sequence ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 10930: A-Sequence 解題者:陳盈村 解題日期: 2008 年 5 月 30 日 題意: A-Sequence 需符合以下的條件, 1 ≤ a.
Section 4.2 Probability Models 機率模式. 由實驗看機率 實驗前先列出所有可能的實驗結果。 – 擲銅板:正面或反面。 – 擲骰子: 1~6 點。 – 擲骰子兩顆: (1,1),(1,2),(1,3),… 等 36 種。 決定每一個可能的實驗結果發生機率。 – 實驗後所有的實驗結果整理得到。
845: Gas Station Numbers ★★★ 題組: Problem Set Archive with Online Judge 題號: 845: Gas Station Numbers. 解題者:張維珊 解題日期: 2006 年 2 月 題意: 將輸入的數字,經過重新排列組合或旋轉數字,得到比原先的數字大,
Chapter 10 m-way 搜尋樹與B-Tree
: Function Overloading ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 11032:Function Overloading 解題者:許智祺 解題日期: 2007 年 5 月 8 日 題意:判對輸入之數字是否為.
Hung-Hsiang WuWindows Processing Design1 Chapter10 資料庫元件應用二 Table and Query 元件不同處: 提供 SQL (Structured Query Language) 語法 各種資料庫軟體大都支援 SQL 語法  Oracle 、
Probability Distribution 機率分配 汪群超 12/12. 目的:產生具均等分配的數值 (Data) ,並以 『直方圖』的功能計算出數值在不同範圍內出現 的頻率,及繪製數值的分配圖,以反應出該 機率分配的特性。
5 重複迴圈 5.1 增減運算符號 增量運算符號 減量運算符號
Biological Science Database 個人化服務設定步驟. Biological Science Database 僅提供專題選 粹服務 專題選粹 (Alerts) :查詢後,提供儲存檢 索策略的功能,日後每週將符合條件的 更新資料,採 方式通知。每筆設定 最多每週可收到.
SQL 進階查詢.
著作權所有 © 旗標出版股份有限公司 第 3 章 資料庫物件的關係. 本章提要 Access 資料庫物件的關係 Access 資料庫物件的關係 簡介 Access 的七大物件 簡介 Access 的七大物件 Access 的群組 Access 的群組.
Visual C++重點複習.
OmniFile Full Text 系列資料庫 個人化服務設定步驟. 此相關資料庫之個人化服 務只提供類似專題選粹的 服務,然無提供 mail 通知的 服務,讀者可建立個人 ID , 並儲存檢索策略,日後需 再進入該資料庫,查詢檢 索策略之新進文章。 導航目次 個人化服務說明 個人帳號密碼申請 個人化服務設定.
Microsoft Excel.
著作權所有 © 旗標出版股份有限公司 第 14 章 製作信封、標籤. 本章提要 製作單一信封 製作單一郵寄標籤.
第 1 章 PC 的基本構造. 本章提要 PC 系統簡介 80x86 系列 CPU 及其暫存器群 記憶體: Memory 80x86 的分節式記憶體管理 80x86 的 I/O 結構 學習組合語言的基本工具.
VHDL語法(3).
程式設計 Visual Basic 6.0 Visual Basic 6.0 Visual Basic 6.0 程式設計 Visual Basic 6.0 Visual Basic 6.0 Visual Basic 6.0許翠婷
2013 Fall 1 Chapter 8: Advanced SQL 楊立偉教授 台灣大學工管系 註 : 於 11 版為 Chapter 7.
DEFAULT Values and the MERGE Statement. 2 home back first prev next last What Will I Learn? Understand when to specify a DEFAULT value. Construct and.
20 Copyright © Oracle Corporation, All rights reserved. Oracle9 i Extensions to DML and DDL Statements.
6 Extraction, Transformation, and Loading (ETL) Transformation.
ADO.NET. ADO.NET 精靈化設計 精靈化設計 程式化設計 程式化設計 SQL 指令 SQL 指令 DataGrid, DataList DataGrid, DataList DataBind DataBind.
SQL1-ch8 操作資料 (DML) 1. 題號  80 題: 47 、 67  140 題: 12 、 49 、 50 、 55 、 79 、 80 、 89 、
ORACLE SQL Fundamental II 4-5 章重點 Chap 4 Managing Objects with Data Dictionary Views Chap 5 Manipulating Large Data Sets 1. subqueries ( inline view :
SQL1-ch5 顯示多個表格的資料. 題號  80 題: 34 、 57 、 71 、 72  140 題: 18 、 25 、 62 、 97 、 115 、 131.
SQL1-ch10 其他綱要物件. 題號  80 題: 5 、 9 、 18 、 32 、 38 、 41 、 44 、 54 、 77  140 題: 76 、 78 、 120 、 132.
INSERT Statement. 2 home back first prev next last What Will I Learn? Give examples of why it is important to be able to alter the data in a database.
SQL1-ch1 使用SQL SELECT 敘述句擷取資料.
SQL1-ch3 使用單列函數自訂輸出. 考古題題號  80 題: 7 、 37  140 題: 30 、 43 、 52 、 84 、 86 、 127.
SQL2-ch4 群組相關資料以產生報表. 題號  80 題: 11 、 20 、 43 、 59 、 70 、 80  140 題: 14 、 88 、 113.
SQL1-ch4 群組函數與聚總資料. 題號  80 題: 33 、 39  140 題: 10 、 59 、 95 、 110.
ERP Purge Manual 2007/10/2 TinaLee. 2 Purge Job  Interface Purge  Transaction Purge  Other DataPurge (Like Customer 、 Vendor 、 Employee Data)
SQL1-ch9 使用 DDL 建立與管理表格 1. 題號  80 題: 63 、 76  140 題: 6 、 24 、 44 、 71 、 77 、 92 2.
2 Copyright © 2009, Oracle. All rights reserved. Managing Schema Objects.
ATS Application Programming: Java Programming
20761B 10: Using Subqueries Module 10   Using Subqueries.
“Manipulating Data” Lecture 6.
“Manipulating Data” Lecture 6.
高级子查询 Schedule: Timing Topic 60 minutes Lecture 50 minutes Practice
IST 318 Database Administration
Presentation transcript:

SQL2-ch3 操控大型資料集

題號 80題:1、17 、 24 、 36 、 45 、 58。 140題:8 、 32 、 48 、 67 、 73 、 139。

使用子查詢來操作資料 使用DML 敘述句中的子查詢來: 將資料從一個表格複製到另一個表格 從一個內嵌視觀表中取得資料 基於另一個表格的值來更新表格中的資料 基於另一個表格的資料列來刪除表格中的資料列

另一個表格複製資料列

Q24/80 View the Exhibit and examine the structure of the ORDERS table: The ORDER_ID column has the PRIMARY KEY constraint and CUSTOMER_ID has the NOT NULL constraint. Evaluate the following statement: INSERT INTO (SELECT order_id, order_date, customer_id FROM ORDERS WHERE order_total = 1000 WITH CHECK OPTION) VALUES (13, SYSDATE, 101); What would be the outcome of the above INSERT statement?

INSERT INTO (SELECT order_id, order_date, customer_id FROM ORDERS WHERE order_total = 1000 WITH CHECK OPTION) VALUES (13, SYSDATE, 101); A. It would execute successfully and the new row would be inserted into a new temporary table created by the subquery. B. It would execute successfully and the ORDER_TOTAL column would have the value 1000 inserted automatically in the new row. C. It would not execute successfully because the ORDER_TOTAL column is not specified in the SELECT list and no value is provided for it. D. It would not execute successfully because all the columns from the ORDERS table should have been included in the SELECT list and values should have been provided for all the columns.

基於另一個表格來刪除資料列

多重表格INSERT 敘述

Q1/80 A. external table B. the MERGE command You need to load information about new customers from the NEW_CUST table into the tables CUST and CUST_SPECIAL. If a new customer has a credit limit greater than 10,000, then the details have to be inserted into CUST_SPECIAL. All new customer details have to be inserted into the CUST table. Which technique should be used to load the data most efficiently? A. external table B. the MERGE command C. the multitable INSERT command D. INSERT using WITH CHECK OPTION

多重表格INSERT 無條件性INSERT 條件性ALL INSERT 條件性FIRST INSERT 樞紐性INSERT

Q17/80 View the Exhibit and examine the structure of the MARKS_DETAILS and MARKS tables. Which is the best method to load data from the MARKS_DETAILS table to the MARKS table?

A. Pivoting INSERT B. Unconditional INSERT C. Conditional ALL INSERT D A. Pivoting INSERT B. Unconditional INSERT C. Conditional ALL INSERT D. Conditional FIRST INSERT

Merge 有條件地更新插入資料庫表格 如果存在資料列,則執行UPDATE 如果為新資料列,則執行INSERT

Merge

Q45/80 View the Exhibit and examine the structure of the CUSTOMERS table. CUSTOMER_VU is a view based on CUSTOMERS_BR1 table which has the same structure as CUSTOMERS table. CUSTOMERS needs to be updated to reflect the latest information about the customers. What is the error in the following MERGE statement?

MERGE INTO customers c USING customer_vu cv ON (c. customer_id = cv MERGE INTO customers c USING customer_vu cv ON (c.customer_id = cv.customer_id) WHEN MATCHED THEN UPDATE SET c.customer_id = cv.customer_id, c.cust_name = cv.cust_name, c.cust_email = cv.cust_email, c.income_level = cv.income_level WHEN NOT MATCHED THEN INSERT VALUES(cv.customer_id, cv.cust_name, cv.cust_email, cv, income_level) WHERE cv.income_level >100000;

A. The CUSTOMER_ID column cannot be updated. B. The INTO clause is misplaced in the command. C. The WHERE clause cannot be used with INSERT. D. CUSTOMER_VU cannot be used as a data source.

Q58/80 Evaluate the following statement: CREATE TABLE bonuses (employee_id NUMBER, bonus NUMBER DEFAULT 100); The details of all employees who have made sales need to be inserted into the BONUSES table. You can obtain the list of employees who have made sales based on the SALES_REP_ID column of the ORDERS table. The human resources manager now decides that employees with a salary of $8,000 or less should receive a bonus. Those who have not made sales get a bonus of 1% of their salary. Those who have made sales get a bonus of 1% of their salary and also a salary increase of 1%. The salary of each employee can be obtained from the EMPLOYEES table. Which option should be used to perform this task most efficiently?

A. MERGE B. Unconditional INSERT C. Conditional ALL INSERT D. Conditional FIRST INSERT

追蹤資料的變更 使用SCN或Timestamp追蹤

Q36/80 Evaluate the following statements: CREATE TABLE digits (id NUMBER(2), description VARCHAR2(15)); INSERT INTO digits VALUES (1, ‘ONE'); UPDATE digits SET description ='TWO' WHERE id=1; INSERT INTO digits VALUES (2,'TWO'); COMMIT; DELETE FROM digits; SELECT description FROM digits VERSIONS BETWEEN TIMESTAMP MINVALUE AND MAXVALUE; What would be the outcome of the above query?

A. It would not display any values. B A. It would not display any values. B. It would display the value TWO once. C. It would display the value TWO twice. D. It would display the values ONE, TWO, and TWO.

Q8/140 The details of the order ID, order date, order total, and customer ID are obtained from the ORDERS table. If the order value is more than 30000, the details have to be added to the LARGE_ORDERS table. The order ID, order date, and order total should be added to the ORDER_HISTORY table, and order ID and customer ID should be added to the CUST_HISTORY table. Which multitable INSERT statement would you use? A. Pivoting INSERT B. Unconditional INSERT C. Conditional ALL INSERT D. Conditional FIRST INSERT

Q32/140 Evaluate the following statement: INSERT ALL WHEN order_total < 10000 THEN INTO small_orders WHEN order_total > 10000 AND order_total < 20000 THEN INTO medium_orders WHEN order_total > 2000000 THEN INTO large_orders SELECT order_id, order_total, customer_id FROM orders; Which statement is true regarding the evaluation of rows returned by the subquery in the INSERT statement?

A. They are evaluated by all the three WHEN clauses regardless of the results of the evaluation of any other WHEN clause. B. They are evaluated by the first WHEN clause. If the condition is true, then the row would be evaluated by the subsequent WHEN clauses. C. They are evaluated by the first WHEN clause. If the condition is false, then the row would be evaluated by the subsequent WHEN clauses. D. The INSERT statement would give an error because the ELSE clause is not present for support in case none of the WHEN clauses are true.

Q48/140 View the Exhibit button and examine the structures of ORDERS and ORDER_ITEMS tables. In the ORDERS table, ORDER_ID is the PRIMARY KEY and in the ORDER_ITEMS table, ORDER_ID and LINE_ITEM_ID form the composite primary key. Which view can have all the DML operations performed on it?

A. CREATE VIEW V1 AS SELECT order_id, product_id FROM order_items; B A. CREATE VIEW V1 AS SELECT order_id, product_id FROM order_items; B. CREATE VIEW V4 (or_no, or_date, cust_id) AS SELECT order_id, order_date, customer_id FROM orders WHERE order_date < '30-mar-2007' WITH CHECK OPTION; C. CREATE VIEW V3 AS SELECT o.order_id, o.customer_id, i.product_id FROM orders o, order_items i WHERE o.order_id=i.order_id; D. CREATE VIEW V2 AS SELECT order_id, line_item_id, unit_price*quantity total FROM order_items;

Q67/140 View the Exhibit and examine the data in the CUST_DET table. You executed the following multitable INSERT statement: INSERT FIRST WHEN credit_limit >= 5000 THEN INTO cust_1 VALUES (cust_id, credit_limit, grade, gender) WHEN grade = 'A' THEN INTO cust_2 VALUES (cust_id, credit_limit, grade, gender) WHEN gender = 'M' THEN INTO cust_3 VALUES (cust_id, credit_limit, grade, gender) INTO cust_4 VALUES (cust_id, credit_limit, grade, gender) ELSE INTO cust_5 VALUES (cust_id, credit_limit, grade, gender) SELECT * FROM cust_det; The row will be inserted in _______.

A. CUST_1 table only because CREDIT_LIMIT condition is satisfied B A. CUST_1 table only because CREDIT_LIMIT condition is satisfied B. CUST_1 and CUST_2 tables because CREDIT_LIMIT and GRADE conditions are satisfied C. CUST_1,CUST_2 and CUST_5 tables because CREDIT_LIMIT and GRADE conditions are satisfied but GENDER condition is not satisfied D. CUST_1, CUST_2 and CUST_4 tables because CREDIT_LIMIT and GRADE conditions are satisfied for CUST_1 and CUST_2, and CUST_4 has no condition on it

Q73/140 View the Exhibit and examine the data in ORDERS_MASTER and MONTHLY_ORDERS tables. Evaluate the following MERGE statement: MERGE INTO orders_master o USING monthly_orders m ON (o.order_id = m.order_id) WHEN MATCHED THEN UPDATE SET o.order_total = m.order_total DELETE WHERE (m.order_total IS NULL) WHEN NOT MATCHED THEN INSERT VALUES (m.order_id, m.order_total); What would be the outcome of the above statement?

A. The ORDERS_MASTER table would contain the ORDER_IDs 1 and 2. B A. The ORDERS_MASTER table would contain the ORDER_IDs 1 and 2. B. The ORDERS_MASTER table would contain the ORDER_IDs 1, 2 and 3. C. The ORDERS_MASTER table would contain the ORDER_IDs 1, 2 and 4. D. The ORDERS_MASTER table would contain the ORDER_IDs 1, 2, 3 and 4.

Q139/140 View the Exhibit and examine the structure of ORDERS and CUSTOMERS tables. Evaluate the following UPDATE statement: UPDATE (SELECT order_date, order_total, customer_id FROM orders) SET order_date = '22-mar-2007' WHERE customer_id IN (SELECT customer_id FROM customers WHERE cust_last_name = 'Roberts' AND credit_limit = 600); Which statement is true regarding the execution of the above UPDATE statement?

A. It would not execute because two tables cannot be used in a single UPDATE statement. B. It would execute and restrict modifications to only the columns specified in the SELECT statement. C. It would not execute because a subquery cannot be used in the WHERE clause of an UPDATE statement. D. It would not execute because the SELECT statement cannot be used in place of the table name.