Book Image

Learning SQLite for iOS

By : Gene Da Rocha
Book Image

Learning SQLite for iOS

By: Gene Da Rocha

Overview of this book

The ability to use SQLite with iOS provides a great opportunity to build amazing apps. Apple's iOS SDK provides native support for SQLite databases. This combination offers the potential to create powerful, data-persistent applications. This book starts with the architecture of SQLite database and introduces you to concepts in SQL . You will find yourself equipped to design your own database system, administer it, and maintain it. Further, you will learn how to operate your SQLite databases smoothly using SQL commands. You will be able to extend the functionality of SQLite by using its vast arsenal of C API calls to build some interesting, exciting, new, and intelligent data-driven applications. Understand how Xcode, HTML5, and Phonegap can be used to build a cross-platform modern app which can benefit from all these technologies - all through creating a complete, customizable application skeleton that you can build on for your own apps.
Table of Contents (15 chapters)
Learning SQLite for iOS
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

SQL basics


SQLite also has some other features for using SQL, such as finding the greatest id from a column, and also the last insert and its id, as shown in the following:

Insert with a subselect clause

The INSERT statement is the one used to add data into the database. However, the example to date has only shown data from fixed information or program variables. There is another way to insert data, which comes from another table based on the select criteria and data/column matching. This is an insert with a subselect clause; see the following example:

SQLite> Insert into Salary values (Select id, name, salary from salary_import where name='Smith');

SQLite> Select * from Salary where name like '%smith%';

There are several variations available on the format, as shown in the preceding example. The SQL is flexible and there are options to select different data and offer computations on the last row of IDs.

Update with a subselect clause

As discussed in the previous chapters, the UPDATE statement...