如何保存更改至SQLiteStudio(3.4.3)

huangapple go评论46阅读模式
英文:

How to save changes to SQLiteStudio (3.4.3)

问题

select name,
DATE(datum, '-6 months')
as datum
from concerts;

英文:

I am trying to save my changes (code below) in all rows in 1 column by using the export option but my database is not affected. Date in my column is set to September and I successfully changed it to march but just in SQL editor. How do I save these changes?

select name,
DATE(datum, '-6 months')
as datum
from concerts;

答案1

得分: 1

如果你想更新列 datum,那么你需要一个 UPDATE 语句:

UPDATE concerts 
SET datum = date(datum, '-6 months');

如果你想将行插入到另一个表中,那么你需要一个 INSERT 语句:

INSERT INTO other_table (name, datum)
SELECT name, date(datum, '-6 months')
FROM concerts;

如果你想创建一个新表:

CREATE TABLE new_table AS 
SELECT name, date(datum, '-6 months')
FROM concerts;
英文:

If you want to update the column datum then you need an UPDATE statement:

UPDATE concerts 
SET datum = date(datum, '-6 months');

If you want to insert the rows in a different table then you need an INSERT statement:

INSERT INTO other_table (name, datum)
SELECT name, date(datum, '-6 months')
FROM concerts;

If you want to create a new table:

CREATE TABLE new_table AS 
SELECT name, date(datum, '-6 months')
FROM concerts;

huangapple
  • 本文由 发表于 2023年2月8日 19:21:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/75385038.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定