ePUB is an open, industry-standard format for eBooks. However, support of ePUB and its many features varies across reading devices and applications. Use your device or app settings to customize the presentation to your liking. Settings that you can customize often include font, font size, single or double column, landscape or portrait mode, and figures that you can click or tap to enlarge. For additional information about the settings and features on your reading device or app, visit the device manufacturers Web site.
Many titles include programming code or configuration examples. To optimize the presentation of these elements, view the eBook in single-column, landscape mode and adjust the font size to the smallest setting. In addition to presenting code and configurations in the reflowable text format, we have included images of the code that mimic the presentation found in the print book; therefore, where the reflowable format may compromise the presentation of the code listing, you will see a Click here to view code image link. Click the link to view the print-fidelity code image. To return to the previous page viewed, click the Back button on your device or app.
Sams Teach Yourself SQL in 24 Hours
Ryan Stephens
Seventh Edition
Sams Teach Yourself SQL in 24 Hours, Seventh Edition
Copyright 2022 by Pearson Education, Inc.
All rights reserved. Printed in the United States of America. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permissions, request forms, and the appropriate contacts within the Pearson Education Global Rights & Permissions Department, please visit www.pearson.com/permissions. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Nor is any liability assumed for damages resulting from the use of the information contained herein.
ISBN-13: 978-0-13-754312-0
ISBN-10: 0-13-754312-3
Library of Congress Control Number: 2021948117
ScoutAutomatedPrintCode
Trademarks
All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Sams Publishing cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark.
Warning and Disclaimer
Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. The information provided is on an as is basis. The author and the publisher shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book.
Special Sales
For information about buying this title in bulk quantities, or for special sales opportunities (which may include electronic versions; custom cover designs; and content particular to your business, training goals, marketing focus, or branding interests), please contact our corporate sales department at or (800) 382-3419.
For government sales inquiries, please contact .
For questions about sales outside the U.S., please contact .
Editor-in-Chief
Mark Taub
Acquisitions Editor
Malobika Chakraborty
Development Editor
Mark Renfrow
Managing Editor
Sandra Schroeder
Senior Project Editor
Tonya Simpson
Copy Editor
Krista Hansing Editorial Services
Indexer
Cheryl Lenser
Proofreader
Betty Pessagno
Cover Designer
Chuti Prasertsith
Compositor
codemantra
Pearsons Commitment to Diversity, Equity, and Inclusion
Pearson is dedicated to creating bias-free content that reflects the diversity of all learners. We embrace the many dimensions of diversity, including but not limited to race, ethnicity, gender, socioeconomic status, ability, age, sexual orientation, and religious or political beliefs.
Education is a powerful force for equity and change in our world. It has the potential to deliver opportunities that improve lives and enable economic mobility. As we work with authors to create content for every product and service, we acknowledge our responsibility to demonstrate inclusivity and incorporate diverse scholarship so that everyone can achieve their potential through learning. As the worlds leading learning company, we have a duty to help drive change and live up to our purpose to help more people create a better life for themselves and to create a better world.
Our ambition is to purposefully contribute to a world where:
Everyone has an equitable and lifelong opportunity to succeed through learning.
Our educational products and services are inclusive and represent the rich diversity of learners.
Our educational content accurately reflects the histories and experiences of the learners we serve.
Our educational content prompts deeper discussions with learners and motivates them to expand their own learning (and worldview).
While we work hard to present unbiased content, we want to hear from you about any concerns or needs with this Pearson product so that we can investigate and address them.
About the Author
Ryan Stephens is an entrepreneur who has built his career and multiple IT companies around SQL, data, and relational databases. He has shared his knowledge and experience with organizations, students, and IT professionals all over the world. Two of the companies he has co-founded, Perpetual Technologies, Inc. (PTI), and Indy Data Partners, have provided expert database and IT services to large-scale government and commercial clients for more than 25 years. Ryan has authored several books for Pearson, including Sams Teach Yourself SQL in 24 Hours, 6th Edition; some of his books have been translated and published internationally. Additionally, Ryan has worked for large organizations and has consulted within the areas of SQL, database design, database management, and project management. He designed and taught a database management program for Indiana UniversityPurdue University in Indianapolis and currently teaches online SQL and database classes for Pearson Education.
Dedication
This book is dedicated to my daughter,
Charlie Marie, named after my late adoptive mom,
Charlotte Anne Pritchett Stephens, who is the first person I remember
teaching me to write. I love you both.
Acknowledgments
First of all, I would like to thank the contributing authors to previous editions of this book, Ronald Plew and Arie D. Jones.
Ronald Plew is my retired co-founder of Perpetual Technologies and is a great friend. I could not have started my first successful business without him. Ron studied and consulted in the field of relational database technology for more than 20 years, is a published author, and helped me build a database training program at Indiana UniversityPurdue University (IUPUI) in Indianapolis. Ron taught SQL and database classes at IUPUI for 5 years.