oracle缺失值表示,Oracle SQL,用最接近的非缺失填充缺失值
我有一個數據集,我想用最接近的非缺失值來填充缺失值。我在this問題的答案中找到了兩種優雅的解決方案,但我不明白為什么它們對我不起作用。
表格:
input.txt
嘗試#1:
'use strict';
import React, { Component } from "react";
import { Text, View, TextInput, StyleSheet } from 'react-native';
class Home extends Component {
constructor(props) {
super(props);
this.state = {
name:''
email:''
nameError:''
emailError:''
};
}
onChangeText = name => text => this.setState({ [name]: text });
render() {
let { name, email, nameError, emailError } = this.state;
return (
{nameError}
{emailError}
)
}
}
const styles = StyleSheet.create({
text: {
padding: 10,
fontSize: 42
},
container: {
padding: 10
}
});
export default Home;
嘗試#2:
create table Tab1(data date, V1 number);
insert into Tab1 values (date '2000-01-01', 1);
insert into Tab1 values (date '2000-02-01', 1);
insert into Tab1 values (date '2000-03-01', 1);
insert into Tab1 values (date '2000-04-01', 1);
insert into Tab1 values (date '2000-05-01', NULL);
insert into Tab1 values (date '2000-06-01', NULL);
insert into Tab1 values (date '2000-03-01', 2);
insert into Tab1 values (date '2000-04-01', 2);
insert into Tab1 values (date '2000-05-01', NULL);
insert into Tab1 values (date '2000-06-01', NULL);
select * from Tab1;
DATA V1
2000-01-01 1
2000-02-01 1
2000-03-01 1
2000-04-01 1
2000-05-01
2000-06-01
2000-03-01 2
2000-04-01 2
2000-05-01
2000-06-01
兩者都會給我同樣的不良結果:
select A.*,
(case when V1 is null then lag(V1 ignore nulls)
over (partition by V1 order by V1, data)
else V1
end) V2
from Tab1 A;
我在做什么錯了?
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的oracle缺失值表示,Oracle SQL,用最接近的非缺失填充缺失值的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 向合资燃油车发起总攻,比亚迪秦 PLUS
- 下一篇: oracle nowday,Java M