Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database Management -- Fields in Tables #3554

Open
JrgMyr opened this issue Aug 15, 2019 · 2 comments

Comments

@JrgMyr
Copy link

commented Aug 15, 2019

Where are the fields (row) information stored inside of a database?
The table "sqlite_master" has tables and views but not the field info.

Is there any other way to get to the field names in a given table than parsing the CREATE TABLE code? I imagine a second management table that links rows to table names. Does this exist?

Best, Jörg

@JrgMyr

This comment has been minimized.

Copy link
Author

commented Aug 15, 2019

Ok, I found something myself. Apologies for not finding it during previous researches.
There is a PRAGMA table_info which doubles as a table-valued function and can be used like this in a regular query:

select * from pragma_table_info('tablename');

Out of curiosity: where is this info stored inside the database?

@pawelsalawa

This comment has been minimized.

Copy link
Owner

commented Aug 15, 2019

It's all in sqlite_master. Everything you need to know about any table or view is stored there.

The only exception is when you create temporary objects (CREATE TEMP ...) - in that case they are in sqlite_temp_master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.