I have 4 columns hotel_name, is_pool ,is_wifi ,is_gym.First time when i start the loop 10 hotels will added in hotel_name column and 1 is added to is_pool column. Second time when the loop starts for wifi it will check if the hotels already exist in hotel_name column then it will add 1 in is_spa(infront of that hotel which already exist like avari-hotel in below example) ,if these hotels not exist then it will add new hotel in hotel_name column and add 1 in is_wifi column same for is_gym etc...
Hotel_name Is_pool Is_wifi Is_gym
Grand_hayat 1 0 0
Royal-marria 1 0 0
Peart-continent 1 0 0
Sub-hotelways 1 0 0
Grand_marqs 1 0 0
Avari hotels 1 1 0
Chenone hotels 1 0 0
Savoey hotels 1 0 0
The grand 1 0 0
Hotel-range 1 0 0
Sub-marry 0 1 0
Royal-reside 0 1 0
Xyz 0 1 0
Abc 0 1 0
. . . .
. . . .
how i achieve this task kindly help :) thanks in advance
CREATE TABLE "Hotels" (
`hotel_id` INTEGER PRIMARY KEY AUTOINCREMENT,
`hotel_name` TEXT NOT NULL,
`is_pool` INTEGER DEFAULT 0,
`is_wifi` INTEGER DEFAULT 0,
`is_gym` INTEGER DEFAULT 0,
)
if(prefrence[i]=='pool'):
c.execute("INSERT INTO hotels (Hotel_name,is_pool) VALUES (?,?)" , [hotel], 1)