Important Announcement
PubHTML5 Scheduled Server Maintenance on (GMT) Sunday, June 26th, 2:00 am - 8:00 am.
PubHTML5 site will be inoperative during the times indicated!

Home Explore DBA_Training_Surin

DBA_Training_Surin

Published by vqcomputer2562, 2020-02-04 22:27:03

Description: DBA_Training_Surin

Search

Read the Text Version

Inserting New Rows – Insert a new row containing values for each column. – List values in the default order of the columns in the table. – Optionally, list the columns in the INSERT clause. INSERT INTO departments(department_id, department_name, manager_id, location_id) VALUES (70, 'Public Relations', 100, 1700); – Enclose character and date values within single quotation marks. Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 151 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

Inserting Rows with Null Values – Implicit method: Omit the column from the column list. INSERT INTO departments (department_id, VALUES department_name) (30, 'Purchasing'); – Explicit method: Specify the NULL keyword in the VALUES clause. INSERT INTO departments VALUES (100, 'Finance', NULL, NULL); Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 152 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

Copying Rows from Another Table – Write your INSERT statement with a subquery: INSERT INTO copy_emp(select * from employees); – Do not use the VALUES clause. – Match the number of columns in the INSERT clause to those in the subquery. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 153

Changing Data in a Table EMPLOYEES Update rows in the EMPLOYEES table: Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 154 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

UPDATE Statement Syntax – Modify existing values in a table with the UPDATE statement: UPDATE table SET column = value [, column = value, ...] [WHERE condition]; – Update more than one row at a time (if required). Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 155 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

Updating Rows in a Table – Values for a specific row or rows are modified if you specify the WHERE clause: UPDATE employees SET department_id = 50 WHERE employee_id = 113; – Values for all the rows in the table are modified if you omit the WHERE clause: UPDATE employees SET department_id = 110; – Specify SET column_name= NULL to update a column value to NULL. Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 156 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

Removing a Row from a Table DEPARTMENTS Delete a row from the DEPARTMENTS table: Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 157 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

DELETE Statement • You can remove existing rows from a table by using the DELETE statement: DELETE [FROM] table [WHERE condition]; Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 158 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

Deleting Rows from a Table – Specific rows are deleted if you specify the WHERE clause: DELETE FROM departments WHERE department_name = ‘Finance'; – All rows in the table are deleted if you omit the WHERE clause: DELETE FROM employees; Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 159 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

Committing Data – Make the changes: DELETE FROM employees WHERE employee_id = 101; INSERT INTO departments VALUES (290, 'Corporate Tax', NULL, 1700); – Commit the changes: COMMIT; Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 160 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

State of the Data After ROLLBACK • Discard all pending changes by using the ROLLBACK statement: – Data changes are undone. – Previous state of the data is restored. – Locks on the affected rows are released. DELETE FROM copy_emp; ROLLBACK ; Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 161 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

pixabay.com gncdcny.org Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 162 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

Why to use Oracle Database? Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 163 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

Oracle • จดุ แขง็ • ความน่าเชือ่ ถอื ทีไ่ ดร้ ับการไว้วางใจท่ัวโลกจากท้งั บรษิ ัทเอกชนจ้านวนมาก และ รัฐบาล • งา่ ยต่อการ search หาข้อมูลเพม่ิ เติม เน่อื งจากจ้านวนผใู้ ชง้ านทสี่ ูง • ระบบความปลอดภัยท่ีเป็นจดุ เด่นทส่ี ุด • มี patch update เพือ่ แก้ไข bug ตลอด • เครือ่ งมือในการ admin และ ปรบั แตง่ ค่า ถกู ตดิ ต้ังมาพร้อมกนั แต่แรก Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 164 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

Oracle • จดุ แขง็ • PL/SQL ชว่ ยลดภาระในการท้างานของ admin อย่างมาก • มี course training รวมถึง Certificate รับรองมากมาย • ความสามารถของ Enterprise Manager Control ( E.M.) ทสี่ ามารถบริหารจดั การ ผ่านทาง web browser ไดง้ า่ ย • มี feature เพิม่ เติมเพอื่ ทา้ Redundancy Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 165 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

Oracle Oracle มีทกุ อย่างตัง้ แต่… • โพรเซสเซอร์ (SPARC) • ฮารด์ แวร์เซิร์ฟเวอร์-สตอเรจ (ของ Sun เดิม) • ระบบปฏบิ ัติการ (Oracle Linux/Solaris) • ภาษาโปรแกรม (Java) • ฐานข้อมลู (Oracle Database/MySQL) • เครอื่ งมอื พฒั นา (NetBeans) Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 166 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

Oracle Oracle มีทกุ อย่างต้งั แต่… • มิดเดิลแวร์ รวมไปถึงแอพลเิ คชนั เฉพาะทางสา้ หรบั ภาคธรุ กจิ อกี หลายสิบ (CRM/ERP/HR/Supply Chain) ฯลฯ • แนวทางแบบน้ีเรยี กว่า Vertical integration หรอื มีผลิตภณั ฑ์ครบตง้ั แตต่ ้นน้ายนั ปลายนา้ • นคี่ ือ \"จดุ เด่น\" ของ Oracle ท่เี หนอื คแู่ ข่งรายอน่ื ๆ ตรงท่ี \"มีครบ\" กว่าใครๆ Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 167 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

Oracle Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 168 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

Oracle Oracle ไดเ้ ปน็ องค์กรท่ถี อื วา่ มี Software Open Source ทเ่ี ยอะทส่ี ดุ และใหญ่ทส่ี ดุ ของโลก เพราะวา่ Oracle ไดร้ วมกบั Sun Microsystems เปน็ ทเ่ี รียบรอ้ ย ซ่ึง Sun ไดช้ ื่อว่า เป็นผู้ ท่ใี ห้บริการดา้ น Open Source Software เยอะท่สี ุด เหตผุ ลที่ Oracle คือองค์กรทมี่ ี Open Source ใหญ่ทีส่ ุดของโลก นัน่ คือ มี Software ที่ ทาง Oracle เป็นผู้สนับสนนุ Open Source เหลา่ นี้ อกี ท้ังยังสนับสนุน Engine เพื่อให้ support products ตวั เองอกี ดว้ ย Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 169 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

Oracle ตวั อยา่ งเชน่ 1. MySQL - MySQL คอื Open Source Database ที่เปน็ ท่ีนยิ มมากที่สุดก็ว่าได้ โดยมผี ู้ใช้งานมาก นับรอ้ ยนบั พันเว็บไซตเ์ ลยทีเดียว 2. OpenOffice.org - เป็นชดุ ออฟฟศิ ที่มคี วามสามารถและการใชง้ านใกลเ้ คียงกับ Microsoft Office ท้างานได้บนหลายแพลตฟอร์มทั้ง Windows, Linux, Mac OS X ฯลฯ 3. InnoDB - เปน็ Database Engine หนึ่งของ MySQL ทเ่ี ปน็ ที่นยิ มเชน่ เดยี วกับ MyISAM InnoDB นัน้ เป็นทนี่ ยิ มเพราะมกี ารรองรับ Transaction, Foreign Key, มี Hash Lookup, และการ Lock ไดถ้ งึ ระดบั Row Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 170 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

Oracle ตวั อย่างเช่น 4. VirtualBox - เป็นโปรแกรมประเภท virtualization ตวั หนึง่ โปรแกรมในกลุ่มนม้ี หี ลกั การท้างาน คือ คุณสามารถรนั อยา่ งนอ้ ย 2 ระบบปฏบิ ัตกิ ารไดใ้ นเวลาเดียวกัน ขน้ึ อยู่กบั ความแรงของ คอมพวิ เตอร์ ในขณะน้ี VirtualBox สามารถในการส่งผา่ นทางไกลหรอื เคลื่อนย้ายได้ ซ่ึงเพ่งิ จะส่งลง แข่งขันกับเทคโนโลยี Server Virtualization เช่นกนั 5. Java - Java เป็น top 3 ท่ีมีผู้ใชง้ านมากท่ีสดุ ในโลก เป็นเทคโนโลยที ่ใี ช้ในการพัฒนาโปรแกรม แบบต่าง ๆ ซึ่งไดแ้ ก่ Application, Applet, Web application (servlet & JSP), EJB, และ Midlet โดยโปรแกรมเหลา่ นีจ้ ะมีลกั ษณะพิเศษทีต่ า่ งจากโปรแกรมที่เขยี นขน้ึ ในภาษาอื่น อย่าง C หรอื C++ คือสามารถท้างานไดห้ ลาย Platform (อย่างเชน่ Windows, Solaris, Linux) โดยไม่ จ้าเปน็ ตอ้ งเขยี นใหม่ หรือ Compile ใหม่ Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 171 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

Oracle ตัวอย่างเช่น 6. NetBeans - เป็นเคร่อื งมอื ส้าหรบั นักโปรแกรมเมอรท์ จ่ี ะใช้พัฒนา Application ด้วยภาษาจาวา ผพู้ ฒั นาภาษาจาวา ไดเ้ ข้ามาเป็นผสู้ นบั สนนุ หลกั ในการพัฒนา NetBeans และไดท้ ้าออกมาในรูป ของ Opensource software โดยผสู้ นใจและนักพฒั นาสามารถนา้ ไปดัดแปลง แกไ้ ขได้ NetBeans IDE ไดร้ ับความนิยมมากย่ิงขึ้น และไดร้ ับการพัฒนาใหม้ ีความสามารถสูงยิ่งขน้ึ เรือ่ ยๆ นอกจากจะใช้ ในการพฒั นา Application ดว้ ยภาษาจาวาแล้ว ยังสามารถพฒั นาอนื่ ๆ ไดอ้ กี หลากหลายโดยติดตง้ั โปรแกรมเสรมิ (Add-on)ไดจ้ ากเว็บไซต์ 7. Linux - Oracle เป็นผ้ใู หก้ ารสนับสนนุ รายหลักของ Linux community ซ่ึงเป็นส่วนหน่งึ ของ Oracle Enterprise Linux (OEL) Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 172 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

Oracle ตัวอย่างเช่น 8. PHP - ภาษาคอมพวิ เตอรใ์ นลักษณะเซิรฟ์ เวอร-์ ไซด์ สคริปต์ โดยลิขสทิ ธ์ิอยู่ในลักษณะโอเพน ซอรส์ ภาษาพเี อชพีใชส้ ้าหรบั จัดท้าเวบ็ ไซต์ และแสดงผลออกมาในรปู แบบ HTML โดยมรี ากฐาน โครงสรา้ งคา้ ส่ังมาจากภาษา C, Java และ Perl ซ่ึง ภาษา PHP นน้ั ง่ายตอ่ การเรยี นรู้ ซง่ึ เปา้ หมาย หลักของภาษานี้ คือใหน้ กั พฒั นาเวบ็ ไซตส์ ามารถเขียน เวบ็ เพจ ท่มี ีความตอบโตไ้ ดอ้ ย่างรวดเร็ว Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 173 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

Why to use Oracle Database? Oracle Database มี • ความน่าเชอ่ื ถอื สูง (Reliable) • เทคโนโลยี Rollback Segment ซ่งึ เปน็ ลขิ สิทธ์ขิ องบริษัท Oracle – ประโยชน์ Rollback Segment ท่ที ้าใหผ้ ลิตภณั ฑ์ของ Oracle ครองตลาดผใู้ ชม้ ากสดุ เน่อื งจากสามารถจดั การกบั ข้อมูลในกรณที ี่เกดิ การลม้ เหลวของระบบ หรือภาวะระบบไม่ สามารถใหบ้ ริการได้ ดว้ ยเทคโนโลยี Rollback Segment จะจัดการ Instance Recovery ข้อมลู ไม่ใหเ้ กดิ ความเสียหายอนั เนอ่ื งมาจากการล้มเหลวของระบบ ไดอ้ ย่างดีมาก • ประสิทธิภาพในการท้างานสูง เหมาะกบั การจดั การเก็บขอ้ มูลขนาดใหญ่ท่ีตอ้ งการความปลอดภัย และความม่ันคงในการใชง้ าน Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 174 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

References • Oracle Database 11g: SQL Fundamental Volume I • ศศวิ มิ ล ฮงมา. (2557). เอกสารประกอบการสอนวชิ าระบบฐานขอ้ มลู เบ้ืองตน้ . คณะวทิ ยาการและเทคโนโลยีสารสนเทศ มหาวทิ ยาลยั เทคโนโลยมี หานคร. Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 175 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

Instructor : SASIWIMOL HONGMA ([email protected]) o Lecturer. Faculty of Information Science and Technology, Mahanakorn University of Technology. (2006-Now) o Head of Information Technology Department. Faculty of Information Science and Technology, Mahanakorn University of Technology. (Now) o Head of Information Technology Major. Department of Information Technology (2012-2015) o Oracle Academy Instructor (2017-Now) o Consultant of Customer Relationship Management system (CRM) for Siam Retail Co., Ltd. (Fashion Island). (2014-2015) o Consultant Team of Logistic for the Central Industries group. (2014-2015) o Deputy Director (IT section) of Registration Office, Mahanakorn University of Technology. (2007-2010) o Lecturer, Department of Information Studies, Faculty of Humanities and Social Science, Khon Kaen University. (2004-2006) o System Analyst, LTEC Co.,Ltd, Lamphun. (2001-2002) o Programmer Analyst in IT Application and System Technology Department. Advance Info Service Co., Ltd. (AIS) (2000) Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 176 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

o PhD.Sc. (Information Technology) * Studying* Faculty of Information Science and Technology, Mahanakorn University of Technology, THAILAND o M.Sc. (Computer Science) Faculty of Science, Chiang Mai University, THAILAND o B.Sc. (Computer Science) Faculty of Science, Chiang Mai University, THAILAND Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 177 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted

Instructor Assistant : Suebtas Limsaihua ([email protected]) o Lecturer. Faculty of Information Science and Technology, Mahanakorn University of Technology. o PhD.Sci. (Information Technology) * Studying* Faculty of Information Science and Technology, Mahanakorn University of Technology, THAILAND o M.Eng. (Computer Engineering) Faculty of Engineer, Mahanakorn University of Technology, THAILAND o B.Eng. (Computer Engineering) Faculty of Engineer, Mahanakorn University of Technology, THAILAND Sasiwimol Hongma. Information Science and Technology, Mahanakorn University of Technology. 178 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted


Like this book? You can publish your book online for free in a few minutes!
Create your own flipbook