-
Announcements
- Computer Science/Game Design Club
- Tues. 4pm - 5pm
- Location: TBD
- Contact Roman Calderon for more info
- Github video game competition
- Promotion video
- Starts Nov. 1
- Computer Science/Game Design Club
- hyperdev.com
- great for web development and interactive web projects
- SQL (feat. Python) by Sean
- SQL follows the syntax:
SELECT ______ FROM ______ WHERE ______ ;
- Python uses sqlite3 to work with SQL databases
- SQL follows the syntax:
import sqlite3
conn = sqlite3.connect(":memory:")
conn.execute('create table students (id integer, name text)')
conn.execute('insert into students values (2020, "Jesse") , (2134, "Sean")')
for row in conn.execute('select * from students'):
print(row)
for row in conn.execute('select name from students'):
print(row[0])
import sqlite3
conn = sqlite3.connect(":memory:")
conn.execute('create table students (id integer primary key autoincrement, name text)')
conn.execute('insert into students(name) values ("Jesse") , ("Sean")')
for row in conn.execute('select * from students') :
print(row)
conn.execute('create table grades (id integer primary key, student integer references student(id), grade text)')
import sqlite3
conn = sqlite3.connect(":memory:")
conn.execute('create table students (id integer primary key autoincrement, name text)')
conn.execute('insert into students(name) values ("Jesse") , ("Sean")')
for row in conn.execute('select * from students') :
print(row)
conn.execute('create table grades (id integer primary key, student integer references student(id), grade text)')
conn.execute('insert into grades(id, student, grade) values (1, 2, "A"), (2, 1, "B"), (3, 2, "A"), (4, 2, "B")')
for row in conn.execute('select * from grades') :
print(row)