Getting Started with SQL

Book description

Businesses are gathering data today at exponential rates and yet few people know how to access it meaningfully. If you’re a business or IT professional, this short hands-on guide teaches you how to pull and transform data with SQL in significant ways. You will quickly master the fundamentals of SQL and learn how to create your own databases.

Author Thomas Nield provides exercises throughout the book to help you practice your newfound SQL skills at home, without having to use a database server environment. Not only will you learn how to use key SQL statements to find and manipulate your data, but you’ll also discover how to efficiently design and manage databases to meet your needs.

You’ll also learn how to:

  • Explore relational databases, including lightweight and centralized models
  • Use SQLite and SQLiteStudio to create lightweight databases in minutes
  • Query and transform data in meaningful ways by using SELECT, WHERE, GROUP BY, and ORDER BY
  • Join tables to get a more complete view of your business data
  • Build your own tables and centralized databases by using normalized design principles
  • Manage data by learning how to INSERT, DELETE, and UPDATE records

Publisher resources

View/Submit Errata

Table of contents

  1. Foreword
  2. Preface
    1. How to Use This Book
    2. Conventions Used in This Book
    3. Using Code Examples
    4. O’Reilly Online Learning
    5. How to Contact Us
    6. Acknowledgments
  3. 1. Why Learn SQL?
    1. What Is SQL and Why Is It Marketable?
    2. Who Is SQL For?
  4. 2. Databases
    1. What Is a Database?
    2. Exploring Relational Databases
    3. Why Separate Tables?
    4. Choosing a Database Solution
    5. Lightweight Databases
    6. Centralized Databases
  5. 3. SQLite
    1. What Is SQLite?
    2. SQLiteStudio
    3. Importing and Navigating Databases
  6. 4. SELECT
    1. Retrieving Data with SQL
    2. Expressions in SELECT Statements
    3. Text Concatenation
    4. Summary
  7. 5. WHERE
    1. Filtering Records
    2. Using WHERE on Numbers
    3. AND, OR, and IN Statements
    4. Using WHERE on Text
    5. Using WHERE on Booleans
    6. Handling NULL
    7. Grouping Conditions
    8. Summary
  8. 6. GROUP BY and ORDER BY
    1. Grouping Records
    2. Ordering Records
    3. Aggregate Functions
    4. The HAVING Statement
    5. Getting Distinct Records
    6. Summary
  9. 7. CASE Statements
    1. The CASE Statement
    2. Grouping CASE Statements
    3. The “Zero/Null” CASE Trick
    4. Summary
  10. 8. JOIN
    1. Stitching Tables Together
    2. INNER JOIN
    3. LEFT JOIN
    4. Other JOIN Types
    5. Joining Multiple Tables
    6. Grouping JOINs
    7. Summary
  11. 9. Database Design
    1. Planning a Database
    2. The SurgeTech Conference
      1. ATTENDEE
      2. COMPANY
      3. PRESENTATION
      4. ROOM
      5. PRESENTATION_ATTENDANCE
    3. Primary and Foreign Keys
    4. The Schema
    5. Creating a New Database
    6. CREATE TABLE
    7. Setting the Foreign Keys
    8. Creating Views
    9. Summary
  12. 10. Managing Data
    1. INSERT
      1. Multiple INSERTs
      2. Testing the Foreign Keys
    2. DELETE
    3. TRUNCATE TABLE
    4. UPDATE
    5. DROP TABLE
    6. Summary
  13. 11. Going Forward
  14. A. Operators and Functions
    1. Appendix A1 – Literal Expression Queries
    2. Appendix A2 – Mathematical Operators
    3. Appendix A3 – Comparison Operators
    4. APPENDIX A4 – Logical Operators
    5. APPENDIX A5 – Text Operators
    6. APPENDIX A6 – Common Core Functions
    7. APPENDIX A7 – Aggregate Functions
    8. APPENDIX A8 – Date and Time Functions
      1. Date Functions
      2. Time Functions
      3. Date/Time Functions
  15. B. Supplementary Topics
    1. APPENDIX B1 – Further Topics of Interest
    2. APPENDIX B2 – Improving Performance with Indexes
    3. Appendix B3 – Transactions
  16. Index
  17. About the Author

Product information

  • Title: Getting Started with SQL
  • Author(s): Thomas Nield
  • Release date: February 2016
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781491938614