Get startedGet started for free

Query information_schema with SELECT

information_schema is a meta-database that holds information about your current database. information_schema has multiple tables you can query with the known SELECT * FROM syntax:

  • tables: information about all tables in your current database
  • columns: information about all columns in all of the tables in your current database
  • …

In this exercise, you'll only need information from the 'public' schema, which is specified as the column table_schema of the tables and columns tables. The 'public' schema holds information about user-defined tables and databases. The other types of table_schema hold system information – for this course, you're only interested in user-defined stuff.

This exercise is part of the course

Introduction to Relational Databases in SQL

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

-- Query the right table in information_schema
SELECT table_name 
FROM information_schema.___
-- Specify the correct table_schema value
WHERE table_schema = '___';
Edit and Run Code