This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle...
Transcript of This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle...
![Page 1: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/1.jpg)
This is CS50
![Page 2: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/2.jpg)
![Page 3: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/3.jpg)
![Page 4: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/4.jpg)
relational databases
![Page 5: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/5.jpg)
sqlite3
![Page 6: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/6.jpg)
.mode csv
.import FILE TABLE
.schema
![Page 7: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/7.jpg)
C
R
U
D
![Page 8: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/8.jpg)
CREATE
READ
UPDATE
DELETE
![Page 9: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/9.jpg)
SQL
![Page 10: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/10.jpg)
INSERT
SELECT
UPDATE
DELETE
...
![Page 11: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/11.jpg)
CREATE TABLE table (column type, ...);
![Page 12: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/12.jpg)
BLOB
INTEGER
NUMERIC
REAL
TEXT
![Page 13: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/13.jpg)
BLOB
INTEGER
smallint
integer
bigint
NUMERIC
REAL
TEXT
![Page 14: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/14.jpg)
BLOB
INTEGER
NUMERIC
REAL
real
double precision
TEXT
![Page 15: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/15.jpg)
BLOB
INTEGER
NUMERIC
boolean
date
datetime
numeric(scale,precision)
time
timestamp
REAL
TEXT
![Page 16: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/16.jpg)
BLOB
INTEGER
NUMERIC
REAL
TEXT
char(n)
varchar(n)
text
![Page 17: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/17.jpg)
INSERT INTO table (column, ...) VALUES(value, ...);
![Page 18: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/18.jpg)
SELECT columns FROM table;
![Page 19: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/19.jpg)
AVG
COUNT
DISTINCT
MAX
MIN
...
![Page 20: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/20.jpg)
WHERE
LIKE
LIMIT
GROUP BY
ORDER BY
JOIN
...
![Page 21: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/21.jpg)
SELECT columns FROM table WHERE condition;
![Page 22: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/22.jpg)
UPDATE table SET column=value WHERE condition;
![Page 23: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/23.jpg)
DELETE FROM table WHERE condition;
![Page 25: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/25.jpg)
title.basics.tsv
tconst tt4786824
titleType tvSeries
primaryTitle The Crown
startYear 2016
genres Drama,History
...
![Page 26: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/26.jpg)
title.basics.tsv
tconst tt4786824
titleType tvSeries
primaryTitle The Crown
startYear 2016
genres Drama,History
...
![Page 27: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/27.jpg)
title.basics.tsv
tconst tt4786824
titleType tvSeries
primaryTitle The Crown
startYear 2016
genres Drama,History
...
![Page 28: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/28.jpg)
title.basics.tsv
tconst tt4786824
titleType tvSeries
primaryTitle The Crown
startYear 2016
genres Drama,History
...
![Page 29: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/29.jpg)
title.basics.tsv
tconst tt4786824
titleType tvSeries
primaryTitle The Crown
startYear 2016
genres Drama,History
...
![Page 30: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/30.jpg)
title.basics.tsv
tconst tt4786824
titleType tvSeries
primaryTitle The Crown
startYear 2016
genres Drama,History
...
![Page 31: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/31.jpg)
title.basics.tsv
tconst tt4786824
titleType tvSeries
primaryTitle The Crown
startYear 2016
genres Drama,History
...
![Page 32: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/32.jpg)
Please don’t eat candy in here btw :)
![Page 33: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/33.jpg)
![Page 34: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/34.jpg)
db = cs50.SQL("sqlite:///shows.db")
![Page 35: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/35.jpg)
![Page 36: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/36.jpg)
![Page 37: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/37.jpg)
title.basics.tsv
tconst tt4786824
titleType tvSeries
primaryTitle The Crown
startYear 2016
genres Drama,History
...
![Page 38: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/38.jpg)
name.basics.tsv
nconst nm2946516
primaryName Claire Foy
birthYear 1984
...
![Page 39: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/39.jpg)
title.principals.tsv
tconst tt4786824
nconst nm2946516
category actress
...
![Page 40: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/40.jpg)
title.ratings.tsv
tconst tt4786824
averageRating 8.7
numVotes 88529
...
![Page 41: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/41.jpg)
![Page 42: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/42.jpg)
PRIMARY KEY
FOREIGN KEY
UNIQUE
INDEX
![Page 43: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/43.jpg)
AUTOINCREMENT
NOT NULL
![Page 44: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/44.jpg)
indexes
![Page 45: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/45.jpg)
B-trees
![Page 46: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/46.jpg)
![Page 47: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/47.jpg)
CREATE INDEX name ON table (column, ...);
![Page 48: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/48.jpg)
CREATE INDEX name ON table (column, ...);
![Page 49: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/49.jpg)
CREATE INDEX name ON table (column, ...);
![Page 50: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/50.jpg)
CREATE INDEX name ON table (column, ...);
![Page 51: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/51.jpg)
CREATE INDEX name ON table (column, ...);
![Page 53: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/53.jpg)
race conditions
![Page 54: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/54.jpg)
rows = db.execute("SELECT likes FROM posts WHERE id=?", id);
likes = rows[0]["likes"]
db.execute("UPDATE posts SET likes = ?", likes + 1);
![Page 55: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/55.jpg)
rows = db.execute("SELECT likes FROM posts WHERE id=?", id);
likes = rows[0]["likes"]
db.execute("UPDATE posts SET likes = ?", likes + 1);
![Page 56: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/56.jpg)
BEGIN TRANSACTION
COMMIT
ROLLBACK
![Page 57: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/57.jpg)
SQL injection attacks
![Page 58: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/58.jpg)
![Page 59: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/59.jpg)
![Page 60: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/60.jpg)
![Page 61: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/61.jpg)
rows = db.execute("SELECT * FROM users WHERE username = ? AND password = ?", username, password)
if len(rows) == 1:
# Logged in!
![Page 62: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/62.jpg)
rows = db.execute("SELECT * FROM users WHERE username = ? AND password = ?", username, password)
if len(rows) == 1:
# Logged in!
![Page 63: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/63.jpg)
rows = db.execute("SELECT * FROM users WHERE username = ? AND password = ?", username, password)
if len(rows) == 1:
# Logged in!
![Page 64: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/64.jpg)
rows = db.execute(f"SELECT * FROM users WHERE username = '{username}' AND password = '{password}'")
if len(rows) == 1:
# Logged in!
![Page 65: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/65.jpg)
rows = db.execute(f"SELECT * FROM users WHERE username = '{username}' AND password = '{password}'")
if len(rows) == 1:
# Logged in!
![Page 66: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/66.jpg)
rows = db.execute(f"SELECT * FROM users WHERE username = '[email protected]'--' AND password = '{password}'")
if len(rows) == 1:
# Logged in!
![Page 67: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/67.jpg)
rows = db.execute(f"SELECT * FROM users WHERE username = '[email protected]'--' AND password = '{password}'")
if len(rows) == 1:
# Logged in!
![Page 68: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/68.jpg)
rows = db.execute("SELECT * FROM users WHERE username = ? AND password = ?", username, password)
if len(rows) == 1:
# Logged in!
![Page 69: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/69.jpg)
xkcd.com/327
![Page 70: This is CS50 · 2019-12-31 · title.basics.tsv tconst tt4786824 titleType tvSeries primaryTitle The Crown startYear 2016 genres Drama,History...](https://reader034.fdocuments.us/reader034/viewer/2022042312/5eda8a58febf237c0c3b7828/html5/thumbnails/70.jpg)
This is CS50