Inserting, Updating, and Deleting Data

You can insert a row of data into a table using the SQL insert statement. The SQL takes this form:

insert into <tablename> (<fieldname>, <fieldname> ...)values (<value>, <value> ...);

You can update rows of data in a table using the SQL update statement. To update a single row in a table with a primary key field named _id, the SQL takes this form:

update <tablename>set <fieldname> = <value>, <fieldname> = <value> ...where _id= <row_id>;

You can delete a single row of data in a table using the SQL delete statement. To delete a single row in a table with a primary key field named _id, the SQL takes this form:

delete from <tablename>where _id= <row_id>; ...

Get Learning Android™ Application Programming: A Hands-On Guide to Building Android Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.