Apress - Mastering Oracle SQL and SQLPlus (2005).pdf

(3476 KB) Pobierz
30084972 UNPDF
30084972.001.png
Mastering Oracle
SQL and SQL*Plus
LEX DE HAAN
30084972.002.png
Mastering Oracle SQL and SQL*Plus
Copyright © 2005 by Lex de Haan
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means,
electronic or mechanical, including photocopying, recording, or by any information storage or retrieval
system, without the prior written permission of the copyright owner and the publisher.
ISBN (pbk): 1-59059-448-7
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence
of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark
owner, with no intention of infringement of the trademark.
Lead Editor: Tony Davis
Technical Reviewers: Cary Millsap and Joakim Treugut
Editorial Board: Steve Anglin, Dan Appleman, Ewan Buckingham, Gary Cornell, Tony Davis, John Franklin,
Jason Gilmore, Chris Mills, Dominic Shakeshaft, Jim Sumser
Project Manager: Beckie Stones
Copy Edit Manager: Nicole LeClerc
Copy Editor: Marilyn Smith
Production Manager: Kari Brooks-Copony
Production Editor: Kelly Winquist
Compositor: Dina Quan
Proofreader: Liz Welch
Indexer: Michael Brinkman
Artist: Kinetic Publishing
Cover Designer: Kurt Krames
Manufacturing Manager: Tom Debolski
Distributed to the book trade in the United States by Springer-Verlag New York, Inc., 233 Spring Street,
6th Floor, New York, NY 10013, and outside the United States by Springer-Verlag GmbH & Co. KG,
Tiergartenstr. 17, 69112 Heidelberg, Germany.
In the United States: phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders@springer-ny.com , or visit
http://www.springer-ny.com . Outside the United States: fax +49 6221 345229, e-mail orders@springer.de ,
or visit http://www.springer.de .
For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219, Berkeley,
CA 94710. Phone 510-549-5930, fax 510-549-5939, e-mail info@apress.com , or visit http://www.apress.com .
The information in this book is distributed on an “as is” basis, without warranty. Although every precaution
has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to
any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly
by the information contained in this work.
The source code for this book is available to readers at http://www.apress.com in the Downloads section,
and also on the author’s web site, at http://www.naturaljoin.nl .
30084972.003.png
Contents at a Glance
Foreword. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
About the Technical Reviewers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
CHAPTER 1 Relational Database Systems and Oracle . . . . . . . . . . . . . . . . . . . . . . . 1
CHAPTER 2 Introduction to SQL, i SQL*Plus, and SQL*Plus . . . . . . . . . . . . . . . . . . 25
CHAPTER 3 Data Definition, Part I . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
CHAPTER 4 Retrieval: The Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
CHAPTER 5 Retrieval: Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
CHAPTER 6 Data Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
CHAPTER 7 Data Definition, Part II . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
CHAPTER 8 Retrieval: Multiple Tables and Aggregation . . . . . . . . . . . . . . . . . . . . 191
CHAPTER 9 Retrieval: Some Advanced Features . . . . . . . . . . . . . . . . . . . . . . . . . . 233
CHAPTER 10 Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
CHAPTER 11 SQL*Plus and i SQL*Plus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
CHAPTER 12 Object-Relational Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
APPENDIX A Quick Reference to SQL and SQL*Plus . . . . . . . . . . . . . . . . . . . . . . . . 349
APPENDIX B Data Dictionary Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
APPENDIX C The Seven Case Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
APPENDIX D Answers to the Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
APPENDIX E Oracle Documentation, Web Sites, and Bibliography . . . . . . . . . . . 443
INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449
iii
30084972.004.png
Zgłoś jeśli naruszono regulamin