Physical Database Design: University of California, Berkeley School of Information
Physical Database Design: University of California, Berkeley School of Information
• Review
– Introduction to SQL
– SQLite
• Physical Database Design
• Access Methods
• Review
– Introduction to SQL
– SQLite
• Physical Database Design
• Access Methods
sqlite> .dump
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE stuff (id int, name varchar(30),address varchar(50));
INSERT INTO "stuff" VALUES(1,'Jane Smith','546 North st.');
INSERT INTO "stuff" VALUES(2,'Bob Jones','234 west st.');
INSERT INTO "stuff" VALUES(3,'John Smith','567 North st.');
COMMIT;
sqlite> .schema
CREATE TABLE stuff (id int, name varchar(30),address varchar(50));
con = lite.connect(':memory:')
with con:
cur = con.cursor()
cur.execute("CREATE TABLE Friends(Id INTEGER PRIMARY KEY,
Name TEXT);")
cur.execute("INSERT INTO Friends(Name) VALUES ('Tom');")
cur.execute("INSERT INTO Friends(Name) VALUES ('Rebecca');")
cur.execute("INSERT INTO Friends(Name) VALUES ('Jim');")
cur.execute("INSERT INTO Friends(Name) VALUES ('Robert');")
lid = cur.lastrowid
print "The last Id of the inserted row is %d" % lid
• Overview
• terminology
• Access methods
User request
Interface 1
External Model
DBMS
Internal Model
Access Methods
Interface 2
Operating
System
Access Methods
Interface 3
Data
Base
• Review
– Introduction to SQL
– SQLite
• Physical Database Design
• Access Methods
Dumpling 1
Harty 2
Getta
Texaci
...
3
… Harty Block 2
Mobile
Sunoci Block 3
Texaci
605
Key Address 610
Value
.
785 5 .
678
805 6
705
710
.
.
791
785
.
.
805
Becker
Harty
Actual Address
Value Block
Number
Adams 2
Becker 1
Dumpling 3
Adams
Getta 2 Getta
Harty 1
Dumpling
F || P || Z|
B || D || F| H || L || P| R || S || Z|
Devils
Hawkeyes Minors Seminoles
Hoosiers Panthers
Aces Flyers
Boilers
Cars
Mobile cs623
CS 623
105, 106