On Tue, Oct 20, 2009 at 11:50 PM, Andy <[email protected]> wrote:
> I'm new to sqlite. Just started on a project that comes with a lot of 
> pre-created tables.
>
> Trying to understand the data structure, I did:
>
>>sqlite3 dev.db
>>select * from sqlite_master;
>
> Some of the output of the above query is a bit confusing to me. I checked out 
> the doc in http://www.sqlite.org/sqlite.html but am still unclear.
>
> A typical output I got is:
>
> table|auth_permission|auth_permission|2|CREATE TABLE "auth_permission" (
>    "id" integer NOT NULL PRIMARY KEY,
>    "name" varchar(50) NOT NULL,
>    "content_type_id" integer NOT NULL,
>    "codename" varchar(100) NOT NULL,
>    UNIQUE ("content_type_id", "codename")
> )
> index|sqlite_autoindex_auth_permission_1|auth_permission|3|
> <snip>
> index|auth_permission_content_type_id|auth_permission|180|CREATE INDEX 
> "auth_permission_content_type_id" ON "auth_permission" ("content_type_id")
>
>
>
> So I got a table "auth_permission" that has 4 columns: id, name, 
> content_type_id, codename.
>
> In the first line:
> table|auth_permission|auth_permission|2|CREATE TABLE "auth_permission" (
> why is "auth_permission" repeated twice?
> Also what does the number "2" before "CREATE TABLE" mean?
>
> And for the line:
> index|sqlite_autoindex_auth_permission_1|auth_permission|3|
> what does "sqlite_autoindex_auth_permission_1"?
> and what about the last number "3" - what does it mean?
>
> And for the 2nd index line:
> index|auth_permission_content_type_id|auth_permission|180|CREATE INDEX 
> "auth_permission_content_type_id" ON "auth_permission" ("content_type_id")
> what does "180" mean?
>

At the sqlite prompt, type .mode columns <enter> then type .h on <enter>

sqlite> .m col
sqlite> .h on

Then SELECT * FROM sqlite_master and your questions will be answered.


> Thanks for your help.
>
>
>
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
Puneet Kishor http://www.punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
-----------------------------------------------------------------------
Assertions are politics; backing up assertions with evidence is science
=======================================================================
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to