Run ❯
Get your
own Python
server
❯
Run Code
Ctrl+Alt+R
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Change Language
Go to Spaces
Ctrl+Alt+P
import sqlite3 con = sqlite3.connect(":memory:") cur = con.cursor() # The database is in memory, so it is # empty every time the program starts. # Create the table and add the rows: cur.execute(""" CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY, CustomerName TEXT, City TEXT, Country TEXT ) """) cur.execute(""" INSERT INTO Customers VALUES (1, 'Alfreds Futterkiste', 'Berlin', 'Germany'), (4, 'Around the Horn', 'London', 'UK'), (6, 'Blauer See Delikatessen', 'Mannheim', 'Germany'), (12, 'Cactus Comidas para llevar', 'Buenos Aires', 'Argentina'), (16, 'Consolidated Holdings', 'London', 'UK'), (18, 'Du monde entier', 'Nantes', 'France') """) con.commit() cur.execute(""" SELECT CustomerName, City FROM Customers WHERE Country = 'Germany' """) for row in cur.fetchall(): print(row)
('Alfreds Futterkiste', 'Berlin')
('Blauer See Delikatessen', 'Mannheim')