How to get all columns from a database? SQL

Let’s say I had a huge database, and I didn’t know the names of any column. Is there a way to select only the columns?

1 Like

You can do a .schema to find out the names of the columns, and well, the rest of the schema.

1 Like

I should have asked this yesterday… but is the correct syntax for getting the schema? I found it on StackOverflow.

SELECT * 
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME='table_name'; 

If you’re doing it on codecademy you can do this:

SELECT *
FROM sqlite_master;

If you have a file open in sqlite3 you can just type

.schema
1 Like