英文:
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;
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论