CREATE TABLE `USER` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE COLUMN TABLE "USER" (
"ID" BIGINT CS_FIXED GENERATED BY DEFAULT AS IDENTITY NOT NULL ,
"NAME" NVARCHAR(200),
"CREATED_DATE" LONGDATE CS_LONGDATE,
PRIMARY KEY ("ID")) UNLOAD PRIORITY 5 AUTO MERGE ;
CREATE SEQUENCE "USER_SEQUENCE";
@Id
@GeneratedValue(strategy = GenerationType.AUTO, generator = "sequence_generator")
@SequenceGenerator(name = "sequence_generator", initialValue = 1, allocationSize = 1, sequenceName = "USER_SEQUENCE")
private Long id;
-- MySQL
uuid()
-- SAP HANA
select SYSUUID from dummy;
-- MySQL
select mid('abcdefg',2,3);
select substring('abcdefg',2);
select substring('abcdefg' from 2);
-- SAP HANA
select left(’abcdefg’, ‘5’) from dummy;
select right(’abcdefg’, ‘5’) from dummy;
-- MySQL
-- The day before today
SELECT DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 DAY),'%Y-%m-%d');
-- The day after today
SELECT DATE_FORMAT(DATE_ADD(NOW(),INTERVAL 1 DAY),'%Y-%m-%d');
-- SAP HANA
-- The day before today
SELECT ADD_DAYS(CURRENT_TIMESTAMP,-1) from dummy
-- The day after today
SELECT ADD_DAYS(CURRENT_TIMESTAMP,1) from dummy
-- MYSQL
-- Mysql group by statement can select fields that are not grouped
select id,name,age from A group by age
-- SAP HANA
-- HANA group by statement can't select fields that are not grouped
select id,name,age from A group by id
-- MYSQL
-- CAST
select * from dummy where is_deleted=0 order by
case when dummy.status='Draft' then cast(1 as signed)
when dummy.status='WaitApproval' then cast(2 as signed)
when dummy.status='Reject' then cast(3 as signed)
when dummy.status='Approve' then cast(4 as signed)
else cast(5 as signed) end asc
-- SAP HANA
-- CAST
select * from dummy where is_deleted=0 order by
case when dummy.status='Draft' then cast(1 as integer)
when dummy.status='WaitApproval' then cast(2 as integer)
when dummy.status='Reject' then cast(3 as integer)
when dummy.status='Approve' then cast(4 as integer)
else cast(5 as integer) end asc
-- MYSQL
-- CONVERT
convert(filed_name, data_type)
-- SAP HANA
-- NO CONVERT method
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
24 | |
11 | |
10 | |
8 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 |