Home > Store > Databases > SQL

larger cover

Add To My Wish List

SQLite

  • By Chris Newman
  • Published Nov 9, 2004 by Sams. Part of the Developer's Library series.
    • Copyright 2005
    • Dimensions: Special (all other)
    • Pages: 336
    • Edition: 1st
    • Book
    • ISBN-10: 0-672-32685-X
    • ISBN-13: 978-0-672-32685-1
    • eBook (Adobe DRM)
    • ISBN-10: 0-7686-6366-0
    • ISBN-13: 978-0-7686-6366-2

Register your product to gain access to bonus material or receive a coupon.

  • Description
  • Downloads
  • Reviews
  • Sample Content

Product Author Bios

Chris Newman is a consultant programmer specializing in the development of custom web-based database applications to a loyal international client base.

A graduate of Keele University, Chris lives in Stoke-on-Trent, England, where he runs Lightwood Consultancy Ltd, the company he founded in 1999 to further his interest in Internet technology. Lightwood operates web hosting services under the DataSnake brand and is proud to be one of the first hosting companies to offer and support SQLite as a standard feature on all accounts.

More information on Lightwood Consultancy Ltd can be found at http://www.lightwood.net, and Chris can be contacted at chris@lightwood.net.

SQLite is a small, fast, embeddable database. What makes it popular is the combination of the database engine and interface into a single library as well as the ability to store all the data in a single file. Its functionality lies between MySQL and PostgreSQL, however it is faster than both databases.

In SQLite, author Chris Newman provides a thorough, practical guide to using, administering and programming this up-and-coming database. If you want to learn about SQLite or about its use in conjunction with PHP this is the book for you.

Downloads

All the files used for the examples in the book - 244 KB --code.zip

Customer Reviews

14 of 18 people found the following review helpful
2.0 out of 5 stars Not great - doesn't cover SQLite 3.0, July 21, 2006
This review is from: SQLite (Paperback)
This is an old book, and doesn't cover the newer SQLite 3.x information.
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


12 of 17 people found the following review helpful
2.0 out of 5 stars Not very useful, March 5, 2006
By 
M. Overweg (the Netherlands) - See all my reviews
(REAL NAME)   
This review is from: SQLite (Paperback)
As far as I know, this is the first book on SQLite and for that Chris Newman deserves a compliment.

Beyond that, this book is not very useful though:

1) It explains some basic SQL syntax but I didn't buy this book to learn SQL.

2) Very little information about the specifics and pitfalls of SQLite syntax, I rarely find what I'm looking for.

3) Being a PHP developer I don't need the chapters on C++, Perl, TCL and Python (about 25% of the book).
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


4 of 8 people found the following review helpful
3.0 out of 5 stars SQL Lite, September 2, 2008
This review is from: SQLite (Paperback)
SQLite is not intended to be a complete replacement to standard Database Management Systems. It IS, however, a good alternative to a full-blown database in some situations. Think of it as a simple database management system with NO RELATIONS - this may or may not be a problem for you and your project.

I would never use SQLite for a web site of any complexity - MySQL and other RDBMS's are simply too plentiful, powerful and easy to use. One great application I've found is to use SQLite in, say, a C++ application such as a game for saving information like player stats and scores. This saves you from having to do file i/o and parsing through text files. In such a situation, talking to an independent database server would cut the player off from the data if he was offline or otherwise not able to communicate with the server.
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


Share your thoughts with other customers:
 See all 3 customer reviews...

Table of Contents

Introduction.

I. GENERAL SQLITE USE.

1. Getting Started.

    Introduction.

    Features and Limitations.

      Speed.

      Portability.

      Security.

      SQL Implementation.

      Customization.

      Supported APIs.

      Scalability.

    When Not to Choose SQLite.

      When SQLite Is Probably Wrong.

      When SQLite Is Probably Right.

    Looking at SQLite Databases.

      The sqlite Tool.

      SQLite Database Browser.

    Help and Support.

2. Working with Data.

    SQLite Basics.

      Prerequisites.

      Obtaining the Sample Database.

      Creating and Connecting to a Database.

      Executing SQL from a File.

      The Sample Database.

      Typeless Data Types.

      The INTEGER PRIMARY KEY.

      Working with Dates.

      Inserting the Sample Data.

      BLOBs and Binary Data.

    Querying and Updating the Database.

      The SELECT Statement.

      The WHERE Clause.

      String Comparisons.

      NULL Values.

      Arithmetic Functions.

      String Operators and Functions.

      Joins.

      Aggregate Functions.

      Ordering Data.

      Limiting Data.

      Updating and Deleting Records.

      Left Joins.

      Nested Subqueries.

      Cartesian Joins.

      Transactions.

      The sqlite_master Table.

3. SQLite Syntax and Use.

    Naming Conventions.

      Valid Characters.

      Name Length.

      Reserved Keywords.

      Case Sensitivity.

    Creating and Dropping Tables.

      Table Column Definitions.

      Resolving Conflicts.

      The CHECK Clause.

      Using Temporary Tables.

    Anatomy of a SELECT Statement.

      The WHERE Clause.

      GROUP BY and Aggregate Functions.

      HAVING Clause.

      Column Aliases.

    Attaching to Another Database.

    Manipulating Data.

      Transactions.

      Inserting Data.

      Updating Data.

      Deleting Data.

      Altering a Table Schema.

      Loading Data from a File.

    Indexes.

      Creating and Dropping Indexes.

      UNIQUE Indexes.

    Views.

      Creating and Dropping Views.

      Using Views.

    Triggers.

      Creating and Dropping Triggers.

      Using Triggers.

      Interrupting a Trigger.

      Creating a Trigger on a View.

    Working with Dates and Times.

      Valid Timestring Formats.

       Displaying a Formatted Date and Time.

      Date and Time Modifiers.

      Handling Different Time Zones.

    SQL92 Features Not Supported.

4. Query Optimization.

    Keys and Indexes.

      What an Index Does.

      How Indexes Work in SQLite.

      Indexing Multiple Columns.

      Unique Indexes.

      When to Create an Index.

      When Indexes Can Be Used.

      Tweaking the Table List.

      Benchmarking.

      Some Examples.

    The EXPLAIN Statement.

      Using Transactions.

      The VACUUM Statement.

      Tuning the Database Itself.

II. USING SQLITE PROGRAMMING INTERFACES.

5. The PHP Interface.

    Configuring PHP for SQLite Support.

      Configuring PHP for Linux/Unix.

      Configuring PHP for Windows.

      Checking for SQLite Support.

      Getting Information About the SQLite Extension.

    Using the PHP SQLite Extension.

      Opening a Database.

      Passing Queries and Commands to SQLite.

      Using Commands That Change the Database.

      Working with Retrieved Data.

     Working with User-Defined Functions.

      The php() Function.

      Creating Aggregating Functions.

      Working with Binary Data in UDFs.

    Using the PEAR Database Class.

6. The C/C++ Interface.

    Preparing to Use the C/C++ Interface.

    Using the C Language Interface.

      Opening and Closing a Database.

      Getting Information About the SQLite Library.

      Executing SQL Statements.

      Using Commands That Change the Database.

      Callback Functions for SELECT Queries.

      Executing SQL Without a Callback Function.

      Fetching a Whole Dataset with sqlite_get_table().

    Adding New SQL Functions.

      Creating Aggregating Functions.

7. The Perl Interface.

    Preparing to Use the SQLite Interface.

    About the Perl DBI.

      Getting Information About the DBI.

      Using DBD Drivers.

    Using the SQLite DBD.

      Opening and Closing the Database.

      Executing SQL Statements.

      Using Bind Variables.

      Using Commands That Change the Database.

      Transactions.

       Fetching Records from the Database.

      Error Checking.

      Tracing.

    Adding New SQL Functions.

      Creating Functions.

      Creating Aggregating Functions.

8. The Tcl Interface.

    Preparing to Use the Tcl Interface.

    Using the Tcl Interface.

      Opening and Closing a Database.

      Executing SQL Statements.

      Using Commands That Change the Database.

      Fetching Records from the Database.

      The onecolumn Database Method.

      Validating an SQL Statement.

      Adjusting the Database Timeout Action.

      Adding New SQL Functions.

9. The Python Interface.

    Preparing to Use the Python Interface.

    Using the Python Interface.

      Opening and Closing a Database.

      Executing SQL Commands.

      Error Handling.

      Connection Parameters.

      Using Commands That Change the Database.

      Transactions.

      Fetching Records from the Database.

      Working with Data Types.

      Adding New SQL Functions.

      Adding Aggregating Functions.

III. SQLITE ADMINISTRATION.

10. General Database Administration.

    The PRAGMA Command.

      Fetching Database Information.

      Altering Database Parameters.

      Altering Database Parameters Permanently.

      Altering Query Parameters.

      Analyzing the Database.

    Backing Up and Restoring Data.

      The .dump Command.

    Exploring the SQLite Virtual Database Engine.

      SQLite Architecture.

      Virtual Machine Opcodes.

    Access to the Database File.

      File Permissions.

      Locking and Timeouts.

      Multithreaded Database Access.

IV. APPENDIXES.

Appendix A. Downloading and Installing SQLite.

    Obtaining SQLite.

      RPM Installation for Linux.

      Binary Installation for Linux.

      Binary Installation for Windows.

      Installing from Source Code.

Appendix B. Command Reference for the sqlite Tool.

    Dot Commands.

      Obtaining a List of Dot Commands.

      Changing the Output Format.

      Reading SQL Commands from a File.

      Sending Output to a File.

      Getting Information about the Database Schema.

      Changing the sqlite Prompts.

      Setting the Database Timeout.

      Exiting the sqlite Tool.

Appendix C. SQL Syntax Reference.

    Naming Conventions.

      Reserved Keywords.

    SQL Command Syntax.

      Creating and Dropping Database Objects.

      The SELECT Statement.

      The INSERT Statement.

      The UPDATE Statement.

      The DELETE Statement.

      The COPY Statement.

      Resolving Conflicts.

      Transactions.

      Attaching to Other Databases.

      Performance Tuning.

      Comments.

    ANSI SQL Commands and Features Not Supported.

      ALTER TABLE.

      COUNT(DISTINCT column-name).

      GRANT and REVOKE.

      INSERT, UPDATE, and DELETE on Views.

      RIGHT OUTER JOIN.

      CHECK and FOREIGN KEY Constraints.

      Trigger Limitations.

      Nested Transactions.

      Variable Subqueries.

Appendix D. PHP Interface Reference.

    Predefined Constants.

    Runtime Configuration.

    Function Reference.

      Opening and Closing a Database.

      Executing a Query.

      Error Reporting.

      Finding Information About a Query.

      Processing a Result Set.

      Random Data Access Functions.

      Convenience Functions.

      Finding Information About SQLite.

      Custom Functions (UDF).

Appendix E. C Interface Reference.

    The Core API.

      Opening and Closing a Database.

      Executing a Query.

      Error Codes.

    The Non-Callback API.

      Creating a Virtual Machine.

      Step-by-Step Execution of an SQL Statement.

      Return Codes.

    The Extended API.

      Finding Information About the SQLite Library.

      Finding Information About Changes to the Database.

      Checking SQL Statements.

      Interrupting an SQL Statement.

      Convenience Functions.

      The _printf() Wrapper Functions.

      Memory Management.

      Dealing with Locked Database Files.

      Performing Background Jobs During Large Queries.

    Adding New SQL Functions.

      Registering Functions.

      Setting Return Values.

      Referencing Arbitrary Data.

Appendix F. Perl Interface Reference.

    The Perl DBI.

      Opening and Closing a Database.

      Executing SQL Statements.

      Using Bind Values.

      Making Data Safe.

      Getting Information About a Query.

      Transactions.

      Fetching Rows from a Query.

      Error Reporting.

      Creating User-Defined Functions.

Appendix G. Tcl Interface Reference.

    The Tcl Library.

      Opening and Closing a Database.

      Executing a Query.

      Convenience Functions.

      Finding Information About a Query.

      Checking SQL Statements.

      Dealing with Locked Database Files.

      Error Reporting.

      Finding Information About SQLite.

      Custom Functions (UDF).

Appendix H. Python Interface Reference.

    Opening and Closing a Database.

      Executing SQL Statements.

      Setting Data Type Mappings.

    Creating User-Defined Functions.

    Error Handling.

Appendix I. The Future of SQLite.

    SQLite Version 3.0.

      Naming Changes.

      File Format Changes.

      Data Typing.

      User-Defined Collating Sequences.

      Improved Concurrency.

Index.

 

Book

This product currently is not for sale.

Buy

eBook (Adobe DRM)  $31.99  $25.59

About Adobe DRM eBooks

Information This eBook requires the free Adobe® Digital Editions software.

Before downloading this DRM-encrypted PDF, be sure to:


  • Install the free Adobe Digital Editions software on your machine. Adobe Digital Editions only works on Macintosh and Windows, and requires the Adobe Flash Player. Please see the official system requirements.
  • Authorize your copy of Adobe Digital Editions using your Adobe ID. If you don't already have an Adobe ID, you can create one here.
Purchase Reward: One Month Free Subscription
By completing any purchase on InformIT, you become eligible for an unlimited access one-month subscription to Safari Books Online.

Get access to thousands of books and training videos about technology, professional development and digital media from more than 40 leading publishers, including Addison-Wesley, Prentice Hall, Cisco Press, IBM Press, O'Reilly Media, Wrox, Apress, and many more. If you continue your subscription after your 30-day trial, you can receive 30% off a monthly subscription to the Safari Library for up to 12 months. That's a total savings of $199.