Search code examples
sqlclickhouse

Creating View/table with custom column


I would like to create view with column with custom values

CREATE VIEW My_view AS
SELECT [1,2,3,4,5,6,7,8] as numbers

I expect to have table with one column and 8 values (it's not necessary numbers)


Solution

  • Try this way:

    CREATE VIEW My_view AS
    SELECT arrayJoin([1, 2, 3, 4, 5, 6, 7, 8]) AS numbers
    
    /* or */
    
    CREATE VIEW My_view AS
    SELECT number
    FROM numbers(1, 8)