Skip to content
Permalink
a5256e7a02
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
48 lines (43 sloc) 2.85 KB
import sqlite3
conn = sqlite3.connect('chatbot.db')
c = conn.cursor()
# Create table
c.execute('''CREATE TABLE restaurants
(RestaurantID integer,
Name text,
Cuisine text,
Mood text,
Address text,
Primary Key(RestaurantID))''')
# Insert Data
c.execute("INSERT INTO restaurants VALUES ('1', 'Las Iguanas', 'Latin American', 'Romantic', 'Lower Precinct')")
c.execute("INSERT INTO restaurants VALUES ('2', 'Nandos', 'Portuguese', 'Casual', 'Lower Precinct')")
c.execute("INSERT INTO restaurants VALUES ('3', 'Cafe Nero', 'Italian', 'Cosy', 'Lower Precinct')")
c.execute("INSERT INTO restaurants VALUES ('4', 'Creams', 'American', 'Romantic', 'Tower Street')")
c.execute("INSERT INTO restaurants VALUES ('5', 'Pizza Express', 'Italian', 'Casual', 'SWIC')")
c.execute("INSERT INTO restaurants VALUES ('6', 'Tumeric Gold', 'Asian', 'Romantic', 'CV1 3BB')")
c.execute("INSERT INTO restaurants VALUES ('7', 'Blue Orchid', 'Indian', 'Romantic', 'CV1 3GR')")
c.execute("INSERT INTO restaurants VALUES ('8', 'Aqua', 'Lebanese', 'Romantic', 'CV1 3GR')")
c.execute("INSERT INTO restaurants VALUES ('9', 'Cafe Rouge', 'French', 'Romantic', 'CV1 4AJ')")
c.execute("INSERT INTO restaurants VALUES ('10', 'Queens Road Mediterranean Kitchen', "
"'European', 'Romantic', 'CV1 3GG')")
c.execute("INSERT INTO restaurants VALUES ('11', 'Playwrights Bar & Bistro', 'British', 'Casual', 'CV1 5RF')")
c.execute("INSERT INTO restaurants VALUES ('12', 'Noodle Bar', 'Chinese', 'Casual', 'CV1 1LH')")
c.execute("INSERT INTO restaurants VALUES ('13', 'Masala Jacks', 'Indian', 'Casual', 'CV6 4BY')")
c.execute("INSERT INTO restaurants VALUES ('14', 'Leave it to Esmie', 'Caribbean', 'Casual', 'CV1 5ED')")
c.execute("INSERT INTO restaurants VALUES ('15', 'The Earl of Mercia', 'Italian', 'Casual', 'CV1 5RE')")
c.execute("INSERT INTO restaurants VALUES ('16', 'Starbucks', 'American', 'Cosy', 'CV1 1NF')")
c.execute("INSERT INTO restaurants VALUES ('17', 'Costa Coffee', 'British Italian', 'Cosy', 'CV1 1DD')")
c.execute("INSERT INTO restaurants VALUES ('18', 'Esquires Coffee', 'British', 'Cosy', 'CV1 1JD')")
c.execute("INSERT INTO restaurants VALUES ('19', 'JamJar', 'American', 'Cosy', 'CV1 1GU')")
c.execute("INSERT INTO restaurants VALUES ('20', 'sprinkles Gelato', 'American', 'Cosy', 'CV1 1AJ')")
c.execute("INSERT INTO restaurants VALUES ('21', 'Mcdonalds', 'American', 'Cosy', 'CV1 1HF')")
conn.commit()
# UPDATE TABLE
c.execute("UPDATE restaurants SET Address = 'CV1 1LL' WHERE RestaurantID = '1'")
c.execute("UPDATE restaurants SET Address = 'CV1 1FE' WHERE RestaurantID = '2'")
c.execute("UPDATE restaurants SET Address = 'CV1 1DX' WHERE RestaurantID = '3'")
c.execute("UPDATE restaurants SET Address = 'CV1 5FZ' WHERE RestaurantID = '4'")
c.execute("UPDATE restaurants SET Address = 'CV1 4BF' WHERE RestaurantID = '5'")
conn.commit()
conn.close()