CREATE TABLE demo_Columnstore (
    id INT ,
    name VARCHAR(50),
    age INT
) ENGINE=ColumnStore;

insert into demo_Columnstore values(1,'john',20);
insert into demo_Columnstore values(2,'peter',30);
insert into demo_Columnstore values(3,'michael',40);



SELECT id, CURRENT_TIMESTAMP() AS dateandtime
FROM demo_Columnstore
GROUP BY id,dateandtime;
-- ERROR : The storage engine for the table doesn't support IDB-1001: Function 'current_timestamp' isn't supported.



-- if you use an already existing column name as alias name for current timestamp , its works but that's not the correct semantics
SELECT id, CURRENT_TIMESTAMP() AS name,age
FROM demo_Columnstore
GROUP BY id,name,age;


select * from demo_Columnstore


-- Workaround for Columnstore
SELECT id, dateandtime,name
FROM (
  SELECT id, CURRENT_TIMESTAMP AS dateandtime,name
  FROM demo_Columnstore
) AS subquery
GROUP BY id, dateandtime,name;


/* ------------------------------------------------- */


CREATE TABLE demo_InnoDB (
    id INT ,
    name VARCHAR(50),
    age INT
) ENGINE=InnoDB;

-- it works 
SELECT id, CURRENT_TIMESTAMP() AS dateandtime
FROM demo_InnoDB
GROUP BY id,dateandtime;


-- sub query also works
SELECT id, dateandtime,age
FROM (
  SELECT id, CURRENT_TIMESTAMP AS dateandtime,age
  FROM demo_InnoDB
) AS subquery
GROUP BY id, dateandtime,age;








