Skip to content

Views

A View is a “virtual table” whose contents are defined by a query. Unlike a standard table, a view does not store data itself; instead, it saves a SQL query that runs dynamically whenever you access the view.

Views are powerful tools for simplifying complex data retrieval, aggregating data for reports, or formatting data specifically for frontend consumption without altering the underlying database structure.

To create a new view:

  1. In the Data Model sidebar, locate the + Add Table button.
  2. Click the dropdown arrow next to it.
  3. Select Add View.

alt text

  1. Write Query: Enter standard SQL SELECT statements to define which columns and rows should appear in the view.
    • Example: SELECT first_name, email FROM students WHERE is_active = true;
  2. Run/Test: Use the Play button (▶) to execute the query and preview the results immediately in the console. This ensures your syntax is correct before saving.

alt text

  1. Write Name: The unique system identifier for the view. This name will be exposed in your API just like a standard table (e.g., activeStudents).
  2. Write Description: An optional text area to document the purpose of the complex query for your team.
  3. Click Save

alt text

  • Data Security: Create a view that exposes only public fields (like names) while hiding sensitive ones (like personal IDs or phone numbers) from specific API consumers.
  • Simplification: Pre-join multiple related tables (e.g., Students + Courses + Grades) into a single virtual table so the frontend can query it easily without complex logic.
  • Reporting: Use SQL aggregation functions (like COUNT, AVG, SUM) to create a view that shows live statistics (e.g., “Monthly Sales Total”) automatically.