我有一个大约 20 列和超过 5000 行的表。对于每一行,我试图用字符串替换第一个空值"end"
。
我有的:
BEGIN TRANSACTION;
/* Create a table called dataframe */
CREATE TABLE dataframe(id integer primary key, col1 text, col2 text, col3 text, col4 text, col5 text);
/* Create few records in this table */
INSERT INTO dataframe VALUES(1,'a',null,null,null,null);
INSERT INTO dataframe VALUES(2,'a','b',null,null,null);
INSERT INTO dataframe VALUES(3,'a','c','d','e', null);
INSERT INTO dataframe VALUES(4,'a','c','d',null, null);
INSERT INTO dataframe VALUES(5,'a','c',null, null, null);
COMMIT;
/* Display all the records from the table */
SELECT * FROM dataframe;
我需要的:
BEGIN TRANSACTION;
/* Create a table called dataframe */
CREATE TABLE dataframe(id integer primary key, col1 text, col2 text, col3 text, col4 text, col5 text);
/* Create few records in this table */
INSERT INTO dataframe VALUES(1,'a','end',null,null,null);
INSERT INTO dataframe VALUES(2,'a','b','end',null,null);
INSERT INTO dataframe VALUES(3,'a','c','d','e', 'end');
INSERT INTO dataframe VALUES(4,'a','c','d','end', null);
INSERT INTO dataframe VALUES(5,'a','c','end', null, null);
COMMIT;
/* Display all the records from the table */
SELECT * FROM dataframe;
我可以FIRST_VALUE()
在行级别上使用吗?