View DB tables more easily

Hi,

Is there way to view the DB tables for reference to view the column names, FK/PK, etc. in each table? Or would we need to query each table individually to see the content>

1 Like

Hey @feedmyboxtoday,
You may use the query PRAGMA table_info(table_name); to find all the columns of a table in the SQLite database.
It is also possible to have all the table names by a query. Just execute the following query-
SELECT name FROM sqlite_master WHERE type ='table';

2 Likes

Going off @Zubair’s response –

It’s also worth looking into other system tables, similar to sqlite_master. Every flavor of SQL – Oracle, SQL Server, PostgreSQL, and MySQL – has different system tables and functionality for viewing database information and schemas. For example, here’s how you’d view all tables in Oracle and PostgreSQL.

To answer your question, there’s probably a query we could write to help view DB tables more easily. It depends on the database that you’re using.

2 Likes