We will be undergoing scheduled maintenance on May 20th, 2013 at 02:00 GMT.
Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com�s entire library of video tutorials.
We will now look at some of the SQL commands that we need for the database access of the ToDo application. We'll be using SQLite Studio, a product by my company LogicalVue Software, for demonstrating SQLite commands and other aspects of SQLite. So to get started, we've launched SQLite Studio, we have an empty database file which we will save, and we'll simply just call this test, and now we have the database properties all visible, and not much else. So let's open a new SQL editor, in here we can type SQL commands. The first command that we need to become familiar with, is the create table command. The create table command as it's name might imply, allows you to create your database tables. Tables consist of a name, and then the columns that will contain the data in the table. So let's create a sample table here called address book. We'll give it an ID column which will be an integer, primary key. So here we've created, well haven't created yet, but here is a table definition for a table called address book with several columns called ID, first name, last name, address, city, state, and zip. These are all text columns. We can run this SQL, commit it, refresh the database, and we now see that this table is available. We'll double click on it, and we can see all the column names, the data types, which one is identified as a primary key, and the original SQL used to create it. The next SQL command is the insert command. This command allows you to add new data to your table. Insert into address book, so here we're telling it the table we want to add the data to, then we list the columns that we want to add, we'll just do two columns now, and then we list the values. So this particular command will add to the address book table, the value Bob into the first name column, and the value Roberts into the last name column. We'll run the SQL, commit the changes, we switch back to the address book tab, and view the data. We now see that there is one row of data in here. Let's add a couple more names. We now have three rows of data. You note that the ID is filled in automatically even though we did not specify it in our insert command. This is because the ID column is specified as an integer primary key. The next command we want to look at is the select command. This simple version of the syntax tells it to select all the columns from the address book table, this is an asterisk, and that means all, so we run this, and we see all the results appear down here on the bottom. We could also pick specific columns, and sort the data and even look for specific information. We can also use the like command, this will find all the last names that contain the letter E. The last command we will look at is update command. The update command let's you change existing data in the table. Here for the person who's last name is Peters, we will update the address field to say one Main Street. We could also do this for all the rows, all three rows have been updated.
| Course: | Real Studio |
| Author: | Paul Lefebvre |
| SKU: | 34190 |
| ISBN: | 1-936334-77-1 |
| Release Date: | 2011-02-02 |
| Duration: | 7 hrs / 87 lessons |
| Work Files: |
Yes |
| Captions: | No |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |