Skip to content

function #1

@Selflocking

Description

@Selflocking

赛题描述

实现一些常见的函数,包括length、round和date_format。

函数是SQL中常见功能之一。这些函数除了用在查询字段上,还可能会出现在条件语句中,作为查询数据过滤条件之一。

为了简化,仅考虑上述三种函数即可,其中length只考虑char类型,round只考虑float类型,date_format只考虑date类型,遇到其他的数据类型返回FAILURE即可。

赛题地址

https://open.oceanbase.com/train/TopicDetails?questionId=600004&subQesitonId=800016&subQuestionName=function

往年情况

2022年

  1. 实现一些常见的函数:length()、round()、date_format()。
  2. 其中length只考虑char类型,round只考虑float类型,date_format只考虑date类型,遇到其他的数据类型返回FAILURE即可。

测试用例示例:

select length('this is a string') as len;
select length(name) from table;
select round(score, 2) from table;
select date_format(u_date, '%Y-%m-%d') from table;

https://open.oceanbase.com/train/TopicDetails?questionId=500003&subQesitonId=700063&subQuestionName=function

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions