Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. --This example will create three tables:
  2. -- * people - persons names with associated autoincremeted id number
  3. -- * groups - groups name with associated autoincremeted id number
  4. -- * groupmembership - holds list of a person and the group of which they are a member
  5. --This illustrates the ability to do private/foreign key enforcement within SQLite
  6. PRAGMA foreign_keys = ON;
  7. CREATE TABLE people(name text, id integer primary key autoincrement);
  8. CREATE TABLE groups(name text, id integer primary key autoincrement);
  9. CREATE TABLE groupmembership(personid integer, groupid integer, foreign key(personid) references people(id), foreign key(groupid) references groups(id));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement