我需要对SQLite数据库进行一些更改,并需要使用For Loop语句来完成这些更改。
在伪代码中,我需要完成以下步骤,并希望在编写这些常规语句时有所帮助:
以上可能没有多大意义。因此,我包括了一些我一直在使用T-SQL成功查询结果的方法。我将在此SQL下面包含我编写的SQL,以使每个人都能了解我要执行的查询类型。
对于如何开始为此编写Python脚本,我没有丝毫想法。谢谢,感谢大家的耐心配合。
-- Searchs for info links tagged with POIs named PM
select * from info where id in (select info_id from info_relations where poi_id in (select id from poi_config where name = "PM") );
select *,(select name from groups where id = group_id) as groupname from poi_config where name= "AM"
-- finding all POIs name AM and renaming them to the parent group name
update poi_config
set name = (select name from groups where id = group_id)
where name = "AM"
-- Worry about this later. Search for PM Calendars with info links
SELECT * FROM info WHERE id IN (SELECT info_id FROM info_relations WHERE poi_id IN (SELECT ID FROM poi_config WHERE name = "PM CALENDAR") );
--
select * from poi_config where name = "SMP"
SELECT * FROM info WHERE id IN (SELECT info_id FROM info_relations WHERE poi_id IN (SELECT ID FROM poi_config WHERE name = "SMP") );
select * from poi_config where name = "AM" AND group_id = (select group_id from poi_config)
select * from info_relations where poi_id = 413
select * from groups where id