Query Builder > Virtual Column

Create Virtual Column from SQL Data

Virtual Columns in Draxlr let you create custom columns using formulas, text, or logic based on your existing table fields.


How to Create a Virtual Column?

  1. Open the Virtual Column Modal

    • In the left sidebar, click on Virtual Column.
  2. Define Your Virtual Column

    • Give your column a name.
    • Enter your formula using the fields from your table. You can use:
      • Arithmetic operations (e.g., price * quantity)
      • String functions (e.g., first_name || ' ' || last_name)
      • Conditional logic (e.g., CASE WHEN amount > 1000 THEN 'High' ELSE 'Low' END)
    • Set the data type like Text, Numeric, Boolean, Date, Date-Time.
  3. Apply and Use

    • Click Save or Execute to add the column to your results.
    • Your new virtual column will now appear in your data table.

SQL Databases & their operations

Database TypeList of Operations / Functions
PostgreSQLPostgreSQL Functions and Operators
MySQLMySQL Functions and Operators
MariaDBMariaDB Functions and Operators
SQL ServerSQL Server Functions (Transact-SQL)
PlanetScaleMySQL Functions and Operators (PlanetScale is MySQL compatible)
YugabyteDBYugabyteDB SQL Functions (YSQL/PostgreSQL)
CockroachDBCockroachDB Functions and Operators
RedshiftAmazon Redshift SQL Functions
BigQueryBigQuery SQL Functions and Operators
SnowflakeSnowflake SQL Functions & Operators
ClickHouseClickHouse Built-in Functions
SupabasePostgreSQL Functions and Operators (Supabase is PostgreSQL compatible)

What can you do with Virtual Columns?

  • Filter: Apply filters using your virtual column just like any other column.
  • Sort: Sort your data based on your new virtual column.
  • Aggregate: Use virtual columns in aggregations (sum, average, etc.).
  • Combine: Create multiple virtual columns and use them together.

Example Use Cases

  • Calculations: total_price = unit_price * quantity
  • String Concatenation: full_name = first_name || ' ' || last_name
  • Category Creation: CASE WHEN score > 80 THEN 'Pass' ELSE 'Fail' END

Tips

  • Virtual columns do not modify your database; they exist only in your current query/view.
  • You can edit or remove virtual columns anytime.
  • Use SQL functions and expressions supported by your database.