Sub DoIt
'Initialize the file, copy from Assets if it doesn't exist
SQL1.Initialize(File.DirDefaultExternal, "SQLite Views.db", True)
'Erase table1 if it exists, and recreate it to have 2 columns
SQL1.ExecNonQuery("DROP TABLE IF EXISTS table1")
SQL1.ExecNonQuery("CREATE TABLE table1 (col1 INTEGER, col2 INTEGER)")
'Fill table1 with simple numbers (3 rows)
SQL1.ExecNonQuery("INSERT INTO table1 VALUES (2, 3)")
SQL1.ExecNonQuery("INSERT INTO table1 VALUES (4, 5)")
SQL1.ExecNonQuery("INSERT INTO table1 VALUES (6, 7)")
'Create a View that has the two columns, and their product in a 3rd column
SQL1.ExecNonQuery("CREATE VIEW view1 AS SELECT col1, col2, (col1 * col2) col3 FROM table1")
'Navigate the View and extract the data
Dim c As Cursor
c = SQL1.ExecQuery("SELECT * FROM view1")
Log("Rows = " & c.RowCount & " and Columns = " & c.ColumnCount)
For x = 0 To c.ColumnCount-1
Log("Column " & x & " is : " & c.GetColumnName(x))
Next
For x = 0 To c.RowCount-1
c.Position = x 'Position the Cursor to Row x
For y = 0 To c.ColumnCount-1
Log("Row " & x & " Col " & y & " is " & c.GetInt2(y))
Next
Next
End Sub