If you are using PHP you can get it this way:
<?php
$dbname = 'base.db';
$db = new SQLite3($dbname);
$sturturequery = $db->query("SELECT sql FROM sqlite_master WHERE name='foo'");
$table = $sturturequery->fetchArray();
echo '<pre>' . $table['sql'] . '</pre>';
$db->close();
?>
You should be able to see the schema by running
.schema <table>
PRAGMA table_info(table_name);
This will work for both: command-line and when executed against a connected database.
A link for more details and example. thanks SQLite Pragma Command
You will get the structure by typing the command:
.schema <tableName>
.schema TableName
Where TableName is the name of the Table
You can use the Firefox add-on called SQLite Manager to view the database's structure clearly.
You can query sqlite_master
SELECT sql FROM sqlite_master WHERE name='foo';
which will return a create table
SQL statement, for example:
$ sqlite3 mydb.sqlite
sqlite> create table foo (id int primary key, name varchar(10));
sqlite> select sql from sqlite_master where name='foo';
CREATE TABLE foo (id int primary key, name varchar(10))
sqlite> .schema foo
CREATE TABLE foo (id int primary key, name varchar(10));
sqlite> pragma table_info(foo)
0|id|int|0||1
1|name|varchar(10)|0||0
Source: Stackoverflow.com