How to Move Object-Relational Mapping into the Database. David Wheeler Kineticode OSCON 2005
|
|
- Nickolas Gardner
- 8 years ago
- Views:
Transcription
1 How to Move Object-Relational Mapping into the Database David Wheeler Kineticode OSCON
2 Polymorphic Database Design David Wheeler Kineticode OSCON
3 Executive summary 3
4 Executive summary Look at simple object-oriented examples 3
5 Executive summary Look at simple object-oriented examples Examine typical database serialization approach 3
6 Executive summary Look at simple object-oriented examples Examine typical database serialization approach Make the database do the work 3
7 Executive summary Look at simple object-oriented examples Examine typical database serialization approach Make the database do the work Let s give it a try 3
8 Start with a class 4
9 Start with a class CD::Album title artist publisher isbn 4
10 Start with a class Simple UML is good UML CD::Album title artist publisher isbn 4
11 Standard Approach 5
12 Standard Approach Rules: 5
13 Standard Approach Rules: Class == Table 5
14 Standard Approach Rules: Class == Table Object == Row 5
15 Standard Approach Rules: Class == Table Object == Row Attribute == Column 5
16 Standard Approach Rules: Class == Table Object == Row Attribute == Column Methodology 5
17 Standard Approach Rules: Class == Table Object == Row Attribute == Column Methodology Create Table 5
18 Standard Approach Rules: Class == Table Object == Row Attribute == Column Methodology Create Table Create SELECT query 5
19 Create a Table 6
20 Create a Table CREATE TABLE album ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, title TEXT, artist TEXT, publisher TEXT, isbn TEXT ); 6
21 Create a Table CREATE TABLE album ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, title TEXT, artist TEXT, publisher TEXT, isbn TEXT ); Not much to see here 6
22 Create a Table CREATE TABLE album ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, title TEXT, artist TEXT, publisher TEXT, isbn TEXT ); Not much to see here Use primary keys! 6
23 Write SELECT query 7
24 Write SELECT query SELECT id, title, artist, publisher, isbn FROM album; 7
25 Write SELECT query SELECT id, title, artist, publisher, isbn FROM album WHERE id =?; 7
26 Write SELECT query SELECT id, title, artist, publisher, isbn FROM album WHERE id =?; Gee, that was easy 7
27 Write SELECT query SELECT id, title, artist, publisher, isbn FROM album WHERE id =?; Gee, that was easy Inflate objects from each row 7
28 Write SELECT query SELECT id, title, artist, publisher, isbn FROM album WHERE id =?; Gee, that was easy Inflate objects from each row Let s see if it works 7
29 Examine the output id title artist publisher isbn Rage Against the Machine Rage Against the Machine Atlantic OK Computer Radiohead Atlantic Elephant The White Stripes BMG P55 4 Get Behind Me Satan The White Stripes BMG Purple Rain Prince and the Revolution Warner Bro Roots of a Revolution James Brown Polydor Blood Sugar Sex Magik Red Hot Chili Peppers Warnter Br Frizzle Fry Primus Atlantic
30 Examine the output id title artist publisher isbn Rage Against the Machine Rage Against the Machine Atlantic OK Computer Radiohead Atlantic Elephant The White Stripes BMG P55 4 Get Behind Me Satan The White Stripes BMG Purple Rain Prince and the Revolution Warner Bro Roots of a Revolution James Brown Polydor Blood Sugar Sex Magik Red Hot Chili Peppers Warnter Br Frizzle Fry Primus Atlantic Hey cool! 8
31 Examine the output id title artist publisher isbn Rage Against the Machine Rage Against the Machine Atlantic OK Computer Radiohead Atlantic Elephant The White Stripes BMG P55 4 Get Behind Me Satan The White Stripes BMG Purple Rain Prince and the Revolution Warner Bro Roots of a Revolution James Brown Polydor Blood Sugar Sex Magik Red Hot Chili Peppers Warnter Br Frizzle Fry Primus Atlantic Hey cool! Single row == single object 8
32 Examine the output id title artist publisher isbn Rage Against the Machine Rage Against the Machine Atlantic OK Computer Radiohead Atlantic Elephant The White Stripes BMG P55 4 Get Behind Me Satan The White Stripes BMG Purple Rain Prince and the Revolution Warner Bro Roots of a Revolution James Brown Polydor Blood Sugar Sex Magik Red Hot Chili Peppers Warnter Br Frizzle Fry Primus Atlantic Hey cool! Single row == single object Single column == single attribute 8
33 Let s add a subclass CD::Album title artist publisher isbn 9
34 Let s add a subclass CD::Album title artist publisher isbn CD::Music::Classical composer conductor soloist orchestra 9
35 Let s add a subclass CD::Album title artist publisher isbn Piece of cake, right? CD::Music::Classical composer conductor soloist orchestra 9
36 Typical Subclassing Approach 10
37 Typical Subclassing Approach Create another table 10
38 Typical Subclassing Approach Create another table Reference the parent class table 10
39 Typical Subclassing Approach Create another table Reference the parent class table Write a two queries for each table 10
40 Typical Subclassing Approach Create another table Reference the parent class table Write a two queries for each table Write a JOIN query for both tables 10
41 Create the new table 11
42 Create the new table CREATE TABLE classical ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, album_id INTEGER NOT NULL REFERENCES album(id), composer TEXT, conductor TEXT, orchestra TEXT ); 11
43 Create the new table CREATE TABLE classical ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, album_id INTEGER NOT NULL REFERENCES album(id), composer TEXT, conductor TEXT, orchestra TEXT ); Hrm not bad 11
44 Create the new table CREATE TABLE classical ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, album_id INTEGER NOT NULL REFERENCES album(id), composer TEXT, conductor TEXT, orchestra TEXT ); Hrm not bad You use foreign keys, right? 11
45 Create the new table CREATE TABLE classical ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, album_id INTEGER NOT NULL REFERENCES album(id), composer TEXT, conductor TEXT, orchestra TEXT ); Hrm not bad You use foreign keys, right? What about the SELECT statement? 11
46 Write SELECT query 12
47 Write SELECT query SELECT m.id, title, artist, publisher, isbn, c.id composer, conductor, orchestra FROM album m JOIN classical c ON m.id = c.album_id; 12
48 Write SELECT query SELECT m.id, title, artist, publisher, isbn, c.id composer, conductor, orchestra FROM album m JOIN classical c ON m.id = c.album_id; Also not too bad 12
49 Write SELECT query SELECT m.id, title, artist, publisher, isbn, c.id composer, conductor, orchestra FROM album m JOIN classical c ON m.id = c.album_id; Also not too bad Let s see how it works 12
50 What s wrong here? id title id composer Emperor Concerto 1 Beethoven 10 Eroica Symphony 2 Beethoven 11 Amadeus Soundtrack 3 Mozart 13
51 What s wrong here? id title id composer Emperor Concerto 1 Beethoven 10 Eroica Symphony 2 Beethoven 11 Amadeus Soundtrack 3 Mozart Two IDs? That s annoying 13
52 What s wrong here? id title id composer Emperor Concerto 1 Beethoven 10 Eroica Symphony 2 Beethoven 11 Amadeus Soundtrack 3 Mozart Two IDs? That s annoying Different ID for the same object 13
53 What s wrong here? id title id composer Emperor Concerto 1 Beethoven 10 Eroica Symphony 2 Beethoven 11 Amadeus Soundtrack 3 Mozart Two IDs? That s annoying Different ID for the same object Which to use? 13
54 What s wrong here? id title id composer Emperor Concerto 1 Beethoven 10 Eroica Symphony 2 Beethoven 11 Amadeus Soundtrack 3 Mozart Two IDs? That s annoying Different ID for the same object Which to use? Stick to one and avoid the problem. 13
55 Create the table again 14
56 Create the table again CREATE TABLE classical ( id INTEGER NOT NULL PRIMARY KEY REFERENCES album (id), composer TEXT, conductor TEXT, orchestra TEXT ); 14
57 Create the table again CREATE TABLE classical ( id INTEGER NOT NULL PRIMARY KEY REFERENCES album (id), composer TEXT, conductor TEXT, orchestra TEXT ); Gee, that s simpler 14
58 Create the table again CREATE TABLE classical ( id INTEGER NOT NULL PRIMARY KEY REFERENCES album (id), composer TEXT, conductor TEXT, orchestra TEXT ); Gee, that s simpler The primary key is also a foreign key 14
59 Create the table again CREATE TABLE classical ( id INTEGER NOT NULL PRIMARY KEY REFERENCES album (id), composer TEXT, conductor TEXT, orchestra TEXT ); Gee, that s simpler The primary key is also a foreign key You still use the foreign key constraint, right? 14
60 Write SELECT query again 15
61 Write SELECT query again SELECT m.id AS id, title, artist, publisher, isbn, composer, conductor, orchestra FROM album m JOIN classical c ON m.id = c.id; 15
62 Write SELECT query again SELECT m.id AS id, title, artist, publisher, isbn, composer, conductor, orchestra FROM album m JOIN classical c ON m.id = c.id; That got a bit simpler, too 15
63 Write SELECT query again SELECT m.id AS id, title, artist, publisher, isbn, composer, conductor, orchestra FROM album m JOIN classical c ON m.id = c.id; That got a bit simpler, too Disambiguate the ID column 15
64 Write SELECT query again SELECT m.id AS id, title, artist, publisher, isbn, composer, conductor, orchestra FROM album m JOIN classical c ON m.id = c.id; That got a bit simpler, too Disambiguate the ID column Let s see if it works 15
65 Now we re talkin! id title composer conductor Emperor Concerto Beethoven Ozawa 10 Eroica Symphony Beethoven Bernstein 11 Amadeus Soundtrack Mozart Neville Ma 16
66 Now we re talkin! id title composer conductor Emperor Concerto Beethoven Ozawa 10 Eroica Symphony Beethoven Bernstein 11 Amadeus Soundtrack Mozart Neville Ma Just one ID 16
67 Now we re talkin! id title composer conductor Emperor Concerto Beethoven Ozawa 10 Eroica Symphony Beethoven Bernstein 11 Amadeus Soundtrack Mozart Neville Ma Just one ID But why must we write a JOIN query? 16
68 Now we re talkin! id title composer conductor Emperor Concerto Beethoven Ozawa 10 Eroica Symphony Beethoven Bernstein 11 Amadeus Soundtrack Mozart Neville Ma Just one ID But why must we write a JOIN query? Couldn t it be even simpler? 16
69 Now we re talkin! id title composer conductor Emperor Concerto Beethoven Ozawa 10 Eroica Symphony Beethoven Bernstein 11 Amadeus Soundtrack Mozart Neville Ma Just one ID But why must we write a JOIN query? Couldn t it be even simpler? Can t we truly have one class == one table? 16
70 Yes, it can! SELECT m.id AS id, title, artist, publisher, isbn, composer, conductor, orchestra FROM album m JOIN classical c ON m.id = c.id; 17
71 Yes, it can! CREATE VIEW classical AS SELECT m.id AS id, title, artist, publisher, isbn, composer, conductor, orchestra FROM album m JOIN album_classical c ON m.id = c.id; 17
72 Yes, it can! CREATE VIEW classical AS SELECT m.id AS id, title, artist, publisher, isbn, composer, conductor, orchestra FROM album m JOIN album_classical c ON m.id = c.id; Now we have a single table 17
73 Yes, it can! CREATE VIEW classical AS SELECT m.id AS id, title, artist, publisher, isbn, composer, conductor, orchestra FROM album m JOIN album_classical c ON m.id = c.id; Now we have a single table Rename subclass table to represent inheritance 17
74 Yes, it can! CREATE VIEW classical AS SELECT m.id AS id, title, artist, publisher, isbn, composer, conductor, orchestra FROM album m JOIN album_classical c ON m.id = c.id; Now we have a single table Rename subclass table to represent inheritance Supported by PostgreSQL, SQLite, and MySQL 17
75 Query the VIEW 18
76 Query the VIEW SELECT id, title, artist, publisher, isbn, composer, conductor, orchestra FROM classical; 18
77 Query the VIEW SELECT id, title, artist, publisher, isbn, composer, conductor, orchestra FROM classical; Also a bit simpler 18
78 Query the VIEW SELECT id, title, artist, publisher, isbn, composer, conductor, orchestra FROM classical; Also a bit simpler The database handles inheritance transparently 18
79 Query the VIEW SELECT id, title, artist, publisher, isbn, composer, conductor, orchestra FROM classical; Also a bit simpler The database handles inheritance transparently The VIEW is compiled, thus faster 18
80 Query the VIEW SELECT id, title, artist, publisher, isbn, composer, conductor, orchestra FROM classical; Also a bit simpler The database handles inheritance transparently The VIEW is compiled, thus faster Let s see if it works 18
81 Get the same output id title composer conductor Emperor Concerto Beethoven Ozawa 10 Eroica Symphony Beethoven Bernstein 11 Amadeus Soundtrack Mozart Neville Ma 19
82 Get the same output id title composer conductor Emperor Concerto Beethoven Ozawa 10 Eroica Symphony Beethoven Bernstein 11 Amadeus Soundtrack Mozart Neville Ma Hey, awesome! 19
83 Get the same output id title composer conductor Emperor Concerto Beethoven Ozawa 10 Eroica Symphony Beethoven Bernstein 11 Amadeus Soundtrack Mozart Neville Ma Hey, awesome! Returns the same records as before 19
84 Get the same output id title composer conductor Emperor Concerto Beethoven Ozawa 10 Eroica Symphony Beethoven Bernstein 11 Amadeus Soundtrack Mozart Neville Ma Hey, awesome! Returns the same records as before It s faster, too 19
85 Get the same output id title composer conductor Emperor Concerto Beethoven Ozawa 10 Eroica Symphony Beethoven Bernstein 11 Amadeus Soundtrack Mozart Neville Ma Hey, awesome! Returns the same records as before It s faster, too But what about INSERTs, UPDATEs, and DELETEs? 19
86 Back to the base class 20
87 Back to the base class INSERT INTO album (title, artist, publisher, isbn) VALUES ('Kid B', 'Radiohed', 'Polygramm', '0000'); 20
88 Back to the base class INSERT INTO album (title, artist, publisher, isbn) VALUES ('Kid B', 'Radiohed', 'Polygramm', '0000'); UPDATE album SET title = 'Kid A', artist = 'Radiohead', publisher = 'Polygram', isbn = '4959' WHERE id = 12; 20
89 Back to the base class INSERT INTO album (title, artist, publisher, isbn) VALUES ('Kid B', 'Radiohed', 'Polygramm', '0000'); UPDATE album SET title = 'Kid A', artist = 'Radiohead', publisher = 'Polygram', isbn = '4959' WHERE id = 12; DELETE FROM album WHERE id = 12; 20
90 Back to the base class INSERT INTO album (title, artist, publisher, isbn) VALUES ('Kid B', 'Radiohed', 'Polygramm', '0000'); UPDATE album SET title = 'Kid A', artist = 'Radiohead', publisher = 'Polygram', isbn = '4959' WHERE id = 12; DELETE FROM album WHERE id = 12; Seems pretty straight-forward 20
91 Back to the base class INSERT INTO album (title, artist, publisher, isbn) VALUES ('Kid B', 'Radiohed', 'Polygramm', '0000'); UPDATE album SET title = 'Kid A', artist = 'Radiohead', publisher = 'Polygram', isbn = '4959' WHERE id = 12; DELETE FROM album WHERE id = 12; Seems pretty straight-forward Let s try it 20
92 And now the subclass 21
93 And now the subclass INSERT INTO classical (title, artist, publisher, isbn, composer, conductor, orchestra) VALUES ('Cinema Serenad', 'Itzack Perlman', 'BMC', '2323', 'Verious', 'Jon Williams', 'Pittsburg Symphony'); 21
94 And now the subclass INSERT INTO classical (title, artist, publisher, isbn, composer, conductor, orchestra) VALUES ('Cinema Serenad', 'Itzack Perlman', 'BMC', '2323', 'Verious', 'Jon Williams', 'Pittsburg Symphony'); UPDATE classical SET title = 'Cinema Serenade', artist = 'Itzak Perlman', publisher = 'BMG', isbn = '2764', composer = 'Various', conductor = 'John Williams', orchestra = 'Pittsburgh Symphony' WHERE id = 13; 21
95 And now the subclass INSERT INTO classical (title, artist, publisher, isbn, composer, conductor, orchestra) VALUES ('Cinema Serenad', 'Itzack Perlman', 'BMC', '2323', 'Verious', 'Jon Williams', 'Pittsburg Symphony'); UPDATE classical SET title = 'Cinema Serenade', artist = 'Itzak Perlman', publisher = 'BMG', isbn = '2764', composer = 'Various', conductor = 'John Williams', orchestra = 'Pittsburgh Symphony' WHERE id = 13; DELETE FROM classical WHERE id = 13; 21
96 And now the subclass INSERT INTO classical (title, artist, publisher, isbn, composer, conductor, orchestra) VALUES ('Cinema Serenad', 'Itzack Perlman', 'BMC', '2323', 'Verious', 'Jon Williams', 'Pittsburg Symphony'); UPDATE classical SET title = 'Cinema Serenade', artist = 'Itzak Perlman', publisher = 'BMG', isbn = '2764', composer = 'Various', conductor = 'John Williams', orchestra = 'Pittsburgh Symphony' WHERE id = 13; DELETE FROM classical WHERE id = 13; Let s see if these work 21
97 D oh! What now? INSERT INTO classical (title, artist, publisher, isbn, composer, conductor, orchestra) VALUES ('Cinema Serenad', 'Itzack Perlman', 'BMC', '2323', 'Verious', 'Jon Williams', 'Pittsburg Symphony'); SQL error: cannot modify classical because it is a view 22
98 D oh! What now? INSERT INTO classical (title, artist, publisher, isbn, composer, conductor, orchestra) VALUES ('Cinema Serenad', 'Itzack Perlman', 'BMC', '2323', 'Verious', 'Jon Williams', 'Pittsburg Symphony'); SQL error: cannot modify classical because it is a view VIEWs are not updatable 22
99 D oh! What now? INSERT INTO classical (title, artist, publisher, isbn, composer, conductor, orchestra) VALUES ('Cinema Serenad', 'Itzack Perlman', 'BMC', '2323', 'Verious', 'Jon Williams', 'Pittsburg Symphony'); SQL error: cannot modify classical because it is a view VIEWs are not updatable Must modify the two tables separately 22
100 INSERT classical object 23
101 INSERT classical object INSERT INTO album (title, artist, publisher, isbn) VALUES ('Cinema Serenad', 'Itzack Perlman', 'BMC', '2323'); INSERT INTO album_classical (id, composer, conductor, orchestra) VALUES (last_insert_rowid(), 'Verious', 'Jon Williams', 'Pittsburg Symphony'); 23
102 INSERT classical object INSERT INTO album (title, artist, publisher, isbn) VALUES ('Cinema Serenad', 'Itzack Perlman', 'BMC', '2323'); INSERT INTO album_classical (id, composer, conductor, orchestra) VALUES (last_insert_rowid(), 'Verious', 'Jon Williams', 'Pittsburg Symphony'); We have to modify the two table separately 23
103 INSERT classical object INSERT INTO album (title, artist, publisher, isbn) VALUES ('Cinema Serenad', 'Itzack Perlman', 'BMC', '2323'); INSERT INTO album_classical (id, composer, conductor, orchestra) VALUES (last_insert_rowid(), 'Verious', 'Jon Williams', 'Pittsburg Symphony'); We have to modify the two table separately Use function to populate subclass ID 23
104 INSERT classical object INSERT INTO album (title, artist, publisher, isbn) VALUES ('Cinema Serenad', 'Itzack Perlman', 'BMC', '2323'); INSERT INTO album_classical (id, composer, conductor, orchestra) VALUES (last_insert_rowid(), 'Verious', 'Jon Williams', 'Pittsburg Symphony'); We have to modify the two table separately Use function to populate subclass ID SQLite: last_insert_rowid() 23
105 INSERT classical object INSERT INTO album (title, artist, publisher, isbn) VALUES ('Cinema Serenad', 'Itzack Perlman', 'BMC', '2323'); INSERT INTO album_classical (id, composer, conductor, orchestra) VALUES (last_insert_rowid(), 'Verious', 'Jon Williams', 'Pittsburg Symphony'); We have to modify the two table separately Use function to populate subclass ID SQLite: last_insert_rowid() MySQL: last_insert_id() 23
106 INSERT classical object INSERT INTO album (title, artist, publisher, isbn) VALUES ('Cinema Serenad', 'Itzack Perlman', 'BMC', '2323'); INSERT INTO album_classical (id, composer, conductor, orchestra) VALUES (last_insert_rowid(), 'Verious', 'Jon Williams', 'Pittsburg Symphony'); We have to modify the two table separately Use function to populate subclass ID SQLite: last_insert_rowid() MySQL: last_insert_id() PostgreSQL: CURRVAL('album_id_seq'); 23
107 UPDATE classical object 24
108 UPDATE classical object UPDATE album SET title = 'Cinema Serenade', artist = 'Itzak Perlman', publisher = 'BMG', isbn = '2764' WHERE id = 13; UPDATE album_classical SET composer = 'Various', conductor = 'John Williams', orchestra = 'Pittsburgh Symphony' WHERE id = 13; 24
109 UPDATE classical object UPDATE album SET title = 'Cinema Serenade', artist = 'Itzak Perlman', publisher = 'BMG', isbn = '2764' WHERE id = 13; UPDATE album_classical SET composer = 'Various', conductor = 'John Williams', orchestra = 'Pittsburgh Symphony' WHERE id = 13; Again, modify the two table separately 24
110 DELETE classical object 25
111 DELETE classical object DELETE FROM album_classical WHERE id = 13; DELETE FROM album WHERE id = 13; 25
112 DELETE classical object DELETE FROM album_classical WHERE id = 13; DELETE FROM album WHERE id = 13; And again, modify the two table separately 25
113 DELETE classical object DELETE FROM album_classical WHERE id = 13; DELETE FROM album WHERE id = 13; And again, modify the two table separately Unless your foreign key is ON DELETE CASCADE 25
114 DELETE classical object DELETE FROM album_classical WHERE id = 13; DELETE FROM album WHERE id = 13; And again, modify the two table separately Unless your foreign key is ON DELETE CASCADE Let s see how these queries work 25
115 Is there no other way? 26
116 Is there no other way? The more complex your relations, the more queries 26
117 Is there no other way? The more complex your relations, the more queries All because you can t update VIEWs 26
118 Is there no other way? The more complex your relations, the more queries All because you can t update VIEWs Or can you? 26
119 Updatable views 27
120 Updatable views SQLite supports triggers on VIEWs 27
121 Updatable views SQLite supports triggers on VIEWs PostgreSQL supports rules on VIEWs 27
122 Updatable views SQLite supports triggers on VIEWs PostgreSQL supports rules on VIEWs With work, you can INSERT, UPDATE, and DELETE on VIEWs 27
123 SQLite INSERT trigger 28
124 SQLite INSERT trigger CREATE TRIGGER insert_classical INSTEAD OF INSERT ON classical FOR EACH ROW BEGIN INSERT INTO album (title, artist, publisher, isbn) VALUES (NEW.title, NEW.artist, NEW.publisher, NEW.isbn); INSERT INTO album_classical (id, composer, conductor, orchestra) VALUES (last_insert_rowid(), NEW.composer, NEW.conductor, NEW.orchestra); END; 28
125 SQLite INSERT trigger CREATE TRIGGER insert_classical INSTEAD OF INSERT ON classical FOR EACH ROW BEGIN INSERT INTO album (title, artist, publisher, isbn) VALUES (NEW.title, NEW.artist, NEW.publisher, NEW.isbn); INSERT INTO album_classical (id, composer, conductor, orchestra) VALUES (last_insert_rowid(), NEW.composer, NEW.conductor, NEW.orchestra); END; Use NEW variable to populate values 28
126 SQLite INSERT trigger CREATE TRIGGER insert_classical INSTEAD OF INSERT ON classical FOR EACH ROW BEGIN INSERT INTO album (title, artist, publisher, isbn) VALUES (NEW.title, NEW.artist, NEW.publisher, NEW.isbn); INSERT INTO album_classical (id, composer, conductor, orchestra) VALUES (last_insert_rowid(), NEW.composer, NEW.conductor, NEW.orchestra); END; Use NEW variable to populate values Use last_insert_rowid() for classical ID 28
127 PostgreSQL INSERT rule 29
128 PostgreSQL INSERT rule CREATE RULE insert_classical AS ON INSERT TO classical DO INSTEAD ( INSERT INTO album (title, artist, publisher, isbn) VALUES (NEW.title, NEW.artist, NEW.publisher, NEW.isbn); INSERT INTO album_classical (id, composer, conductor, orchestra) VALUES (CURRVAL('seq_album_id_seq'), NEW.composer, NEW.conductor, NEW.orchestra); ); 29
129 PostgreSQL INSERT rule CREATE RULE insert_classical AS ON INSERT TO classical DO INSTEAD ( INSERT INTO album (title, artist, publisher, isbn) VALUES (NEW.title, NEW.artist, NEW.publisher, NEW.isbn); INSERT INTO album_classical (id, composer, conductor, orchestra) VALUES (CURRVAL('seq_album_id_seq'), NEW.composer, NEW.conductor, NEW.orchestra); ); Use NEW variable to populate values 29
130 PostgreSQL INSERT rule CREATE RULE insert_classical AS ON INSERT TO classical DO INSTEAD ( INSERT INTO album (title, artist, publisher, isbn) VALUES (NEW.title, NEW.artist, NEW.publisher, NEW.isbn); INSERT INTO album_classical (id, composer, conductor, orchestra) VALUES (CURRVAL('seq_album_id_seq'), NEW.composer, NEW.conductor, NEW.orchestra); ); Use NEW variable to populate values Use CURRVAL() to populate classical ID 29
131 SQLite UPDATE trigger 30
132 SQLite UPDATE trigger CREATE TRIGGER update_classical INSTEAD OF UPDATE ON classical FOR EACH ROW BEGIN UPDATE album SET title = NEW.title, artist = NEW.artist, publisher = NEW.publisher, isbn = NEW.isbn WHERE id = OLD.id; UPDATE album_classical SET composer = NEW.composer, conductor = NEW.conductor, orchestra = NEW.orchestra WHERE id = OLD.id; END; 30
133 SQLite UPDATE trigger CREATE TRIGGER update_classical INSTEAD OF UPDATE ON classical FOR EACH ROW BEGIN UPDATE album SET title = NEW.title, artist = NEW.artist, publisher = NEW.publisher, isbn = NEW.isbn WHERE id = OLD.id; UPDATE album_classical SET composer = NEW.composer, conductor = NEW.conductor, orchestra = NEW.orchestra WHERE id = OLD.id; END; Use OLD.id variable to reference existing rows 30
134 PostgreSQL UPDATE rule 31
135 PostgreSQL UPDATE rule CREATE RULE update_classical AS ON UPDATE TO classical DO INSTEAD ( UPDATE album SET title = NEW.title, artist = NEW.artist, publisher = NEW.publisher, isbn = NEW.isbn WHERE id = OLD.id; UPDATE album_classical SET composer = NEW.composer, conductor = NEW.conductor, orchestra = NEW.orchestra WHERE id = OLD.id; ); 31
136 PostgreSQL UPDATE rule CREATE RULE update_classical AS ON UPDATE TO classical DO INSTEAD ( UPDATE album SET title = NEW.title, artist = NEW.artist, publisher = NEW.publisher, isbn = NEW.isbn WHERE id = OLD.id; UPDATE album_classical SET composer = NEW.composer, conductor = NEW.conductor, orchestra = NEW.orchestra WHERE id = OLD.id; ); Use OLD.id variable to reference existing rows 31
137 SQLite DELETE trigger 32
138 SQLite DELETE trigger CREATE TRIGGER delete_classical INSTEAD OF DELETE ON classical FOR EACH ROW BEGIN DELETE FROM album_classical WHERE id = OLD.id; DELETE FROM album WHERE id = OLD.id; END; 32
139 SQLite DELETE trigger CREATE TRIGGER delete_classical INSTEAD OF DELETE ON classical FOR EACH ROW BEGIN DELETE FROM album_classical WHERE id = OLD.id; DELETE FROM album WHERE id = OLD.id; END; Use OLD.id to delete the proper row 32
140 PostgreSQL DELETE rule 33
141 PostgreSQL DELETE rule CREATE RULE delete_classical AS ON DELETE TO classical DO INSTEAD ( DELETE FROM album_classical WHERE id = OLD.id; DELETE FROM album WHERE id = OLD.id; ); 33
142 PostgreSQL DELETE rule CREATE RULE delete_classical AS ON DELETE TO classical DO INSTEAD ( DELETE FROM album_classical WHERE id = OLD.id; DELETE FROM album WHERE id = OLD.id; ); Use OLD.id to delete the proper row 33
143 PostgreSQL DELETE rule CREATE RULE delete_classical AS ON DELETE TO classical DO INSTEAD ( DELETE FROM album_classical WHERE id = OLD.id; DELETE FROM album WHERE id = OLD.id; ); Use OLD.id to delete the proper row Let s see how they work 33
144 Trigger/Rule Advantages 34
145 Trigger/Rule Advantages Queries are pre-compiled 34
146 Trigger/Rule Advantages Queries are pre-compiled Much simpler client-side code 34
147 Trigger/Rule Advantages Queries are pre-compiled Much simpler client-side code Fewer queries sent to the database 34
148 Trigger/Rule Advantages Queries are pre-compiled Much simpler client-side code Fewer queries sent to the database Reduced network overhead 34
149 Trigger/Rule Advantages Queries are pre-compiled Much simpler client-side code Fewer queries sent to the database Reduced network overhead Maintains normalization 34
150 One-to-many relationships 35
151 One-to-many relationships Often have one-to-many relationships 35
152 One-to-many relationships Often have one-to-many relationships Let s we add track objects 35
153 One-to-many relationships Often have one-to-many relationships Let s we add track objects Each refers to a single album object 35
154 One-to-many relationships Often have one-to-many relationships Let s we add track objects Each refers to a single album object Often need to know album information for the track 35
155 One-to-many relationships Often have one-to-many relationships Let s we add track objects Each refers to a single album object Often need to know album information for the track Generally requires two queries, one for each object 35
156 One-to-many relationships Often have one-to-many relationships Let s we add track objects Each refers to a single album object Often need to know album information for the track Generally requires two queries, one for each object SELECT id, title, numb, album_id FROM track; SELECT id, title, artist, publisher, isbn FROM album WHERE id = $album_id; 35
157 JOIN composite objects SELECT track.id AS id, track.title AS title, numb, album.id AS album id, album.title AS album title, artist AS album artist, publisher AS album publisher, isbn AS album isbn FROM track JOIN album ON track.album_id = album.id; 36
158 JOIN composite objects SELECT track.id AS id, track.title AS title, numb, album.id AS album id, album.title AS album title, artist AS album artist, publisher AS album publisher, isbn AS album isbn FROM track JOIN album ON track.album_id = album.id; Or, do a JOIN, instead 36
159 JOIN composite objects SELECT track.id AS id, track.title AS title, numb, album.id AS album id, album.title AS album title, artist AS album artist, publisher AS album publisher, isbn AS album isbn FROM track JOIN album ON track.album_id = album.id; Or, do a JOIN, instead Saves network overhead 36
160 JOIN composite objects SELECT track.id AS id, track.title AS title, numb, album.id AS album id, album.title AS album title, artist AS album artist, publisher AS album publisher, isbn AS album isbn FROM track JOIN album ON track.album_id = album.id; Or, do a JOIN, instead Saves network overhead But might as well make a view for it 36
161 JOIN composite objects CREATE VIEW track AS SELECT _track.id AS id, _track.title AS title, numb, album.id AS album id, album.title AS album title, artist AS album artist, publisher AS album publisher, isbn AS album isbn FROM _track JOIN album ON _track.album_id = album.id; Or, do a JOIN, instead Saves network overhead But might as well make a view for it 36
162 What about MySQL? 37
163 What about MySQL? MySQL 5 supports views 37
164 What about MySQL? MySQL 5 supports views Can INSERT, UPDATE, & DELETE on single table views 37
165 What about MySQL? MySQL 5 supports views Can INSERT, UPDATE, & DELETE on single table views Cannot on multi-table (JOIN) views 37
166 What about MySQL? MySQL 5 supports views Can INSERT, UPDATE, & DELETE on single table views Cannot on multi-table (JOIN) views MySQL supports triggers 37
167 What about MySQL? MySQL 5 supports views Can INSERT, UPDATE, & DELETE on single table views Cannot on multi-table (JOIN) views MySQL supports triggers Cannot assign triggers to views 37
168 What about MySQL? MySQL 5 supports views Can INSERT, UPDATE, & DELETE on single table views Cannot on multi-table (JOIN) views MySQL supports triggers Cannot assign triggers to views No rules 37
169 Resources 38
170 Resources PostgreSQL: Introduction and Concepts by Bruce Momjian 38
171 Resources PostgreSQL: Introduction and Concepts by Bruce Momjian SQLite: 38
172 Resources PostgreSQL: Introduction and Concepts by Bruce Momjian SQLite: MySQL: 38
173 Thank you David Wheeler Kineticode OSCON
Relational Databases and SQLite
Relational Databases and SQLite Charles Severance Python for Informatics: Exploring Information www.pythonlearn.com SQLite Browser http://sqlitebrowser.org/ Relational Databases Relational databases model
More informationRelational Databases. Charles Severance
Relational Databases Charles Severance Relational Databases Relational databases model data by storing rows and columns in tables. The power of the relational database lies in its ability to efficiently
More informationCSI 2132 Lab 3. Outline 09/02/2012. More on SQL. Destroying and Altering Relations. Exercise: DROP TABLE ALTER TABLE SELECT
CSI 2132 Lab 3 More on SQL 1 Outline Destroying and Altering Relations DROP TABLE ALTER TABLE SELECT Exercise: Inserting more data into previous tables Single-table queries Multiple-table queries 2 1 Destroying
More informationReview: Participation Constraints
Review: Participation Constraints Does every department have a manager? If so, this is a participation constraint: the participation of Departments in Manages is said to be total (vs. partial). Every did
More informationAccess Tutorial 2 Building a Database and Defining Table Relationships
Access Tutorial 2 Building a Database and Defining Table Relationships Microsoft Office 2013 Objectives Session 2.1 Learn the guidelines for designing databases and setting field properties Create a table
More informationDatabase Replication with MySQL and PostgresSQL
Database Replication with MySQL and PostgresSQL Fabian Mauchle Schedule Theory Why Replication Replication Layout and Types Conflicts Usage Scenarios Implementations Test Setup and Scenario Conclusion
More informationPostgreSQL Concurrency Issues
PostgreSQL Concurrency Issues 1 PostgreSQL Concurrency Issues Tom Lane Red Hat Database Group Red Hat, Inc. PostgreSQL Concurrency Issues 2 Introduction What I want to tell you about today: How PostgreSQL
More informationThe Relational Model. Ramakrishnan&Gehrke, Chapter 3 CS4320 1
The Relational Model Ramakrishnan&Gehrke, Chapter 3 CS4320 1 Why Study the Relational Model? Most widely used model. Vendors: IBM, Informix, Microsoft, Oracle, Sybase, etc. Legacy systems in older models
More informationMultimedia im Netz Online Multimedia Winter semester 2015/16
Multimedia im Netz Online Multimedia Winter semester 2015/16 Tutorial 04 Minor Subject Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 04 (NF) - 1 Today s Agenda Repetition:
More informationUsing SQL Server Management Studio
Using SQL Server Management Studio Microsoft SQL Server Management Studio 2005 is a graphical tool for database designer or programmer. With SQL Server Management Studio 2005 you can: Create databases
More informationRelational Databases. Christopher Simpkins chris.simpkins@gatech.edu
Relational Databases Christopher Simpkins chris.simpkins@gatech.edu Relational Databases A relational database is a collection of data stored in one or more tables A relational database management system
More informationThe Relational Model. Why Study the Relational Model? Relational Database: Definitions. Chapter 3
The Relational Model Chapter 3 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Why Study the Relational Model? Most widely used model. Vendors: IBM, Informix, Microsoft, Oracle, Sybase,
More informationDbSchema Tutorial with Introduction in SQL Databases
DbSchema Tutorial with Introduction in SQL Databases Contents Connect to the Database and Create First Tables... 2 Create Foreign Keys... 7 Create Indexes... 9 Generate Random Data... 11 Relational Data
More informationFinancial Data Access with SQL, Excel & VBA
Computational Finance and Risk Management Financial Data Access with SQL, Excel & VBA Guy Yollin Instructor, Applied Mathematics University of Washington Guy Yollin (Copyright 2012) Data Access with SQL,
More informationA basic create statement for a simple student table would look like the following.
Creating Tables A basic create statement for a simple student table would look like the following. create table Student (SID varchar(10), FirstName varchar(30), LastName varchar(30), EmailAddress varchar(30));
More informationThe Relational Model. Why Study the Relational Model?
The Relational Model Chapter 3 Instructor: Vladimir Zadorozhny vladimir@sis.pitt.edu Information Science Program School of Information Sciences, University of Pittsburgh 1 Why Study the Relational Model?
More informationDatabase Replication with MySQL and PostgreSQL
Database Replication with MySQL and PostgreSQL Fabian Mauchle Software and Systems University of Applied Sciences Rapperswil, Switzerland www.hsr.ch/mse Abstract Databases are used very often in business
More informationObject Relational Database Mapping. Alex Boughton Spring 2011
+ Object Relational Database Mapping Alex Boughton Spring 2011 + Presentation Overview Overview of database management systems What is ORDM Comparison of ORDM with other DBMSs Motivation for ORDM Quick
More informationSpatiaLite Using SQL Views is really simple and easy a very short introduction
SpatiaLite Using SQL Views is really simple and easy a very short introduction Lots of people are frightened by terms such as: SQL,TABLE, SELECT, VIEW, JOIN Following this step-by-step tutorial you'll
More informationTopics. Database Essential Concepts. What s s a Good Database System? Using Database Software. Using Database Software. Types of Database Programs
Topics Software V:. Database concepts: records, fields, data types. Relational and objectoriented databases. Computer maintenance and operation: storage health and utilities; back-up strategies; keeping
More informationExtracting META information from Interbase/Firebird SQL (INFORMATION_SCHEMA)
13 November 2007 22:30 Extracting META information from Interbase/Firebird SQL (INFORMATION_SCHEMA) By: http://www.alberton.info/firebird_sql_meta_info.html The SQL 2003 Standard introduced a new schema
More informationLecture 6. SQL, Logical DB Design
Lecture 6 SQL, Logical DB Design Relational Query Languages A major strength of the relational model: supports simple, powerful querying of data. Queries can be written intuitively, and the DBMS is responsible
More informationOnce the schema has been designed, it can be implemented in the RDBMS.
2. Creating a database Designing the database schema... 1 Representing Classes, Attributes and Objects... 2 Data types... 5 Additional constraints... 6 Choosing the right fields... 7 Implementing a table
More informationDatabase: SQL, MySQL
Database: SQL, MySQL Outline 8.1 Introduction 8.2 Relational Database Model 8.3 Relational Database Overview: Books.mdb Database 8.4 SQL (Structured Query Language) 8.4.1 Basic SELECT Query 8.4.2 WHERE
More informationCSCI110 Exercise 4: Database - MySQL
CSCI110 Exercise 4: Database - MySQL The exercise This exercise is to be completed in the laboratory and your completed work is to be shown to the laboratory tutor. The work should be done in week-8 but
More informationDatabase Administration with MySQL
Database Administration with MySQL Suitable For: Database administrators and system administrators who need to manage MySQL based services. Prerequisites: Practical knowledge of SQL Some knowledge of relational
More informationB.1 Database Design and Definition
Appendix B Database Design B.1 Database Design and Definition Throughout the SQL chapter we connected to and queried the IMDB database. This database was set up by IMDB and available for us to use. But
More informationIntro to Databases. ACM Webmonkeys 2011
Intro to Databases ACM Webmonkeys 2011 Motivation Computer programs that deal with the real world often need to store a large amount of data. E.g.: Weather in US cities by month for the past 10 years List
More informationDatabase Design and Normalization
Database Design and Normalization 3 CHAPTER IN THIS CHAPTER The Relational Design Theory 48 46 Database Design Unleashed PART I Access applications are database applications, an obvious statement that
More informationPhysical Database Design Process. Physical Database Design Process. Major Inputs to Physical Database. Components of Physical Database Design
Physical Database Design Process Physical Database Design Process The last stage of the database design process. A process of mapping the logical database structure developed in previous stages into internal
More informationTutorial on Relational Database Design
Tutorial on Relational Database Design Introduction Relational database was proposed by Edgar Codd (of IBM Research) around 1969. It has since become the dominant database model for commercial applications
More informationUnit 10: Microsoft Access Queries
Microsoft Access Queries Unit 10: Microsoft Access Queries Introduction Queries are a fundamental means of accessing and displaying data from tables. Queries used to view, update, and analyze data in different
More informationData Modeling. Database Systems: The Complete Book Ch. 4.1-4.5, 7.1-7.4
Data Modeling Database Systems: The Complete Book Ch. 4.1-4.5, 7.1-7.4 Data Modeling Schema: The structure of the data Structured Data: Relational, XML-DTD, etc Unstructured Data: CSV, JSON But where does
More informationSQL Injection. Blossom Hands-on exercises for computer forensics and security
Copyright: The development of this document is funded by Higher Education of Academy. Permission is granted to copy, distribute and /or modify this document under a license compliant with the Creative
More informationIn This Lecture. Physical Design. RAID Arrays. RAID Level 0. RAID Level 1. Physical DB Issues, Indexes, Query Optimisation. Physical DB Issues
In This Lecture Physical DB Issues, Indexes, Query Optimisation Database Systems Lecture 13 Natasha Alechina Physical DB Issues RAID arrays for recovery and speed Indexes and query efficiency Query optimisation
More informationIntroduction to SQL for Data Scientists
Introduction to SQL for Data Scientists Ben O. Smith College of Business Administration University of Nebraska at Omaha Learning Objectives By the end of this document you will learn: 1. How to perform
More informationBBC LEARNING ENGLISH 6 Minute English The Proms
BBC LEARNING ENGLISH 6 Minute English The Proms This is not a word-for-word transcript Hello and welcome to 6 Minute English. I'm and I'm. Hello. Now,, are you doing anything interesting tonight? Well,
More informationThe Relational Model. Why Study the Relational Model? Relational Database: Definitions
The Relational Model Database Management Systems, R. Ramakrishnan and J. Gehrke 1 Why Study the Relational Model? Most widely used model. Vendors: IBM, Microsoft, Oracle, Sybase, etc. Legacy systems in
More informationOnline shopping cart. Tarik Guelzim Graduate school of computer science at Monmouth University. CS517 Database management systems Project 2
Tarik Guelzim Graduate school of computer science at Monmouth University CS517 Database management systems Project 2 Page 1 of 9 Database Schema Page 2 of 9 Table name Indexed fields reason Page 3 of 9
More informationDatabases and DBMS. What is a Database?
Databases and DBMS Eric Lew (MSc, BSc) SeconSys Inc. Nov 2003 What is a Database? Data (singular: datum) Factual Information Database Organized body of related information Repository / storage of information
More informationDIPLOMA IN WEBDEVELOPMENT
DIPLOMA IN WEBDEVELOPMENT Prerequisite skills Basic programming knowledge on C Language or Core Java is must. # Module 1 Basics and introduction to HTML Basic HTML training. Different HTML elements, tags
More informationUsing Microsoft Access Front End to NIMSP MySQL Database
Technical Report Using Microsoft Access Front End to NIMSP MySQL Database by Earl F Glynn 10 Oct. 2013 Contents Purpose... 3 Introduction... 3 National Institute on Money in State Politics... 3 How to
More informationdatabase abstraction layer database abstraction layers in PHP Lukas Smith BackendMedia smith@backendmedia.com
Lukas Smith database abstraction layers in PHP BackendMedia 1 Overview Introduction Motivation PDO extension PEAR::MDB2 Client API SQL syntax SQL concepts Result sets Error handling High level features
More informationCPS352 Database Systems: Design Project
CPS352 Database Systems: Design Project Purpose: Due: To give you experience with designing and implementing a database to model a real domain Various milestones due as shown in the syllabus Requirements
More informationOBJECT ORIENTED EXTENSIONS TO SQL
OBJECT ORIENTED EXTENSIONS TO SQL Thomas B. Gendreau Computer Science Department University Wisconsin La Crosse La Crosse, WI 54601 gendreau@cs.uwlax.edu Abstract Object oriented technology is influencing
More informationAdvanced Online Media Dr. Cindy Royal Texas State University - San Marcos School of Journalism and Mass Communication
Advanced Online Media Dr. Cindy Royal Texas State University - San Marcos School of Journalism and Mass Communication Using SQLite Manager SQL or Structured Query Language is a powerful way to communicate
More informationIENG2004 Industrial Database and Systems Design. Microsoft Access I. What is Microsoft Access? Architecture of Microsoft Access
IENG2004 Industrial Database and Systems Design Microsoft Access I Defining databases (Chapters 1 and 2) Alison Balter Mastering Microsoft Access 2000 Development SAMS, 1999 What is Microsoft Access? Microsoft
More informationDatabase Design and Programming
Database Design and Programming Peter Schneider-Kamp DM 505, Spring 2012, 3 rd Quarter 1 Course Organisation Literature Database Systems: The Complete Book Evaluation Project and 1-day take-home exam,
More informationCommercial Database Software Development- A review.
Commercial Database Software Development- A review. A database software has wide applications. A database software is used in almost all the organizations. Over 15 years many tools have been developed
More informationOutline. Data Modeling. Conceptual Design. ER Model Basics: Entities. ER Model Basics: Relationships. Ternary Relationships. Yanlei Diao UMass Amherst
Outline Data Modeling Yanlei Diao UMass Amherst v Conceptual Design: ER Model v Relational Model v Logical Design: from ER to Relational Slides Courtesy of R. Ramakrishnan and J. Gehrke 1 2 Conceptual
More informationSQL. by Steven Holzner, Ph.D. ALPHA. A member of Penguin Group (USA) Inc.
SQL by Steven Holzner, Ph.D. A ALPHA A member of Penguin Group (USA) Inc. Contents Part 1: Mastering the SQL Basics 1 1 Getting into SQL 3 Understanding Databases 4 Creating Tables Creating Rows and Columns
More informationComputer Security: Principles and Practice
Computer Security: Principles and Practice Chapter 5 Database Security First Edition by William Stallings and Lawrie Brown Lecture slides by Lawrie Brown Database Security 1 Relational Databases constructed
More informationDemystified CONTENTS Acknowledgments xvii Introduction xix CHAPTER 1 Database Fundamentals CHAPTER 2 Exploring Relational Database Components
Acknowledgments xvii Introduction xix CHAPTER 1 Database Fundamentals 1 Properties of a Database 1 The Database Management System (DBMS) 2 Layers of Data Abstraction 3 Physical Data Independence 5 Logical
More informationShort notes on webpage programming languages
Short notes on webpage programming languages What is HTML? HTML is a language for describing web pages. HTML stands for Hyper Text Markup Language HTML is a markup language A markup language is a set of
More informationDatabases and BigData
Eduardo Cunha de Almeida eduardo.almeida@uni.lu Outline of the course Introduction Database Systems (E. Almeida) Distributed Hash Tables and P2P (C. Cassagnes) NewSQL (D. Kim and J. Meira) NoSQL (D. Kim)
More informationIntroduction to Computing. Lectured by: Dr. Pham Tran Vu t.v.pham@cse.hcmut.edu.vn
Introduction to Computing Lectured by: Dr. Pham Tran Vu t.v.pham@cse.hcmut.edu.vn Databases The Hierarchy of Data Keys and Attributes The Traditional Approach To Data Management Database A collection of
More informationOBJECTS AND DATABASES. CS121: Introduction to Relational Database Systems Fall 2015 Lecture 21
OBJECTS AND DATABASES CS121: Introduction to Relational Database Systems Fall 2015 Lecture 21 Relational Model and 1NF 2 Relational model specifies that all attribute domains must be atomic A database
More informationJoostrap RWD Bootstrap Template
Joostrap RWD Bootstrap Template Step by Step Guide to Installing & Set-up Updated 17 th November 2012 Prepared by Philip Locke What is Joostrap?...3 JooStrap & The Basics...3 The Past & How Templating
More informationIST 195 Lab 11: MS Access
Title of lab: Microsoft Access 2010 IST 195 Lab 11: MS Access Learning goal: Databases are collections of information, and database programs are designed to maintain data in structured tables. In this
More informationCreating Database Tables in Microsoft SQL Server
Creating Database Tables in Microsoft SQL Server Microsoft SQL Server is a relational database server that stores and retrieves data for multi-user network-based applications. SQL Server databases are
More informationProduct: DQ Order Manager Release Notes
Product: DQ Order Manager Release Notes Subject: DQ Order Manager v7.1.25 Version: 1.0 March 27, 2015 Distribution: ODT Customers DQ OrderManager v7.1.25 Added option to Move Orders job step Update order
More informationDell World Software User Forum 2013
Dell World User Forum 2013 December 9-12 Austin, TX K1000 Service Desk Advanced Gerald Gillespie & John Verbosky A Typical Day in Corporate America 2 A funny thing happened to me on the way Mary in IT
More informationWhat is a database? COSC 304 Introduction to Database Systems. Database Introduction. Example Problem. Databases in the Real-World
COSC 304 Introduction to Systems Introduction Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca What is a database? A database is a collection of logically related data for
More informationEECS 647: Introduction to Database Systems
EECS 647: Introduction to Database Systems Instructor: Luke Huan Spring 2013 Administrative Take home background survey is due this coming Friday The grader of this course is Ms. Xiaoli Li and her email
More informationDatabases Model the Real World. The Entity- Relationship Model. Conceptual Design. Steps in Database Design. ER Model Basics. ER Model Basics (Contd.
The Entity- Relationship Model R &G - Chapter 2 A relationship, I think, is like a shark, you know? It has to constantly move forward or it dies. And I think what we got on our hands is a dead shark. Woody
More information2/3/04 Doc 7 SQL Part 1 slide # 1
2/3/04 Doc 7 SQL Part 1 slide # 1 CS 580 Client-Server Programming Spring Semester, 2004 Doc 7 SQL Part 1 Contents Database... 2 Types of Databases... 6 Relational, Object-Oriented Databases and SQL...
More informationTalend for Data Integration guide
Talend for Data Integration guide Table of Contents Introduction...2 About the author...2 Download, install and run...2 The first project...3 Set up a new project...3 Create a new Job...4 Execute the job...7
More informationUsing Databases With LabVIEW
Using Databases With LabVIEW LabVIEW User Group Meeting December 2007 Charles Spitaleri ALE System Integration PO Box 832 Melville, NY 11747-0832 +1 (631) 421-1198 ALE System Integration http://www.aleconsultants.com
More informationDeveloping Web Applications for Microsoft SQL Server Databases - What you need to know
Developing Web Applications for Microsoft SQL Server Databases - What you need to know ATEC2008 Conference Session Description Alpha Five s web components simplify working with SQL databases, but what
More informationWI005 - Offline data sync con SQLite in Universal Windows Platform
WI005 - Offline data sync con SQLite in Universal Windows Platform presenta Erica Barone Microsoft Technical Evangelist @_ericabarone erbarone@microsoft.com Massimo Bonanni Microsoft MVP, Intel Black Belt
More informationDEVELOPING AND IMPLEMENTING MULTIUSER, FULLY RELATIONAL GIS DATABASE FOR DESKTOP SYSTEMS USING OPEN SOURCE TECHNOLOGIES
Geographia Technica, Vol. 10, Issue 2, 2015, pp 59 to 65 DEVELOPING AND IMPLEMENTING MULTIUSER, FULLY RELATIONAL GIS DATABASE FOR DESKTOP SYSTEMS USING OPEN SOURCE TECHNOLOGIES Zsolt MAGYARI-SÁSKA 1 ABSTRACT:
More informationN o r m a l i z a t i o n
N o r m a l i z a t i o n One of the most important factors in software development is database definition. If your tables are not set up properly, it can cause you a lot of headaches down the road when
More information4 Simple Database Features
4 Simple Database Features Now we come to the largest use of iseries Navigator for programmers the Databases function. IBM is no longer developing DDS (Data Description Specifications) for database definition,
More information10 Ways to Kill Performance.
10 Ways to Kill Performance. Christophe Pettus PostgreSQL Experts, Inc. PgDay SCALE 9x 25 February 2011 Greetings. Hi, I m Christophe. http://thebuild.com/ PostgreSQL user/developer since 1997 7.2 instance
More informationThe Entity-Relationship Model
The Entity-Relationship Model 221 After completing this chapter, you should be able to explain the three phases of database design, Why are multiple phases useful? evaluate the significance of the Entity-Relationship
More informationWriting a Logical Decoding Plug-In. Christophe Pettus PostgreSQL Experts, Inc. FOSDEM 2015
Writing a Logical Decoding Plug-In. Christophe Pettus PostgreSQL Experts, Inc. FOSDEM 2015 Hello! We re going to talk about logical decoding in PostgreSQL. Christophe Pettus, pleased to meet you. PostgreSQL
More informationPostgreSQL Functions By Example
Postgre joe.conway@credativ.com credativ Group January 20, 2012 What are Functions? Introduction Uses Varieties Languages Full fledged SQL objects Many other database objects are implemented with them
More informationCS 2316 Data Manipulation for Engineers
CS 2316 Data Manipulation for Engineers SQL Christopher Simpkins chris.simpkins@gatech.edu Chris Simpkins (Georgia Tech) CS 2316 Data Manipulation for Engineers SQL 1 / 26 1 1 The material in this lecture
More informationPostgreSQL as a Schemaless Database. Christophe Pettus PostgreSQL Experts, Inc. OSCON 2013
PostgreSQL as a Schemaless Database. Christophe Pettus PostgreSQL Experts, Inc. OSCON 2013 Welcome! I m Christophe. PostgreSQL person since 1997. Consultant with PostgreSQL Experts, Inc. cpettus@pgexperts.com
More informationDatabase Design for the Uninitiated CDS Brownbag Series CDS
Database Design for the Uninitiated Paul Litwin FHCRC Collaborative Data Services 1 CDS Brownbag Series This is the ninth in a series of seminars Materials for the series can be downloaded from www.deeptraining.com/fhcrc
More informationSQL Injection. SQL Injection. CSCI 4971 Secure Software Principles. Rensselaer Polytechnic Institute. Spring 2010 ...
SQL Injection CSCI 4971 Secure Software Principles Rensselaer Polytechnic Institute Spring 2010 A Beginner s Example A hypothetical web application $result = mysql_query(
More informationChapter 22 Database: SQL, MySQL,
Chapter 22 Database: SQL, MySQL, DBI and ADO.NET Outline 22.1 Introduction 22.2 Relational Database Model 22.3 Relational Database Overview: Books.mdb Database 22.4 SQL (Structured Query Language) 22.4.1
More information1 File Processing Systems
COMP 378 Database Systems Notes for Chapter 1 of Database System Concepts Introduction A database management system (DBMS) is a collection of data and an integrated set of programs that access that data.
More informationUsing Microsoft Access
Using Microsoft Access USING MICROSOFT ACCESS 1 Queries 2 Exercise 1. Setting up a Query 3 Exercise 2. Selecting Fields for Query Output 4 Exercise 3. Saving a Query 5 Query Criteria 6 Exercise 4. Adding
More informationKarl Lum Partner, LabKey Software klum@labkey.com. Evolution of Connectivity in LabKey Server
Karl Lum Partner, LabKey Software klum@labkey.com Evolution of Connectivity in LabKey Server Connecting Data to LabKey Server Lowering the barrier to connect scientific data to LabKey Server Increased
More information1. INTRODUCTION TO RDBMS
Oracle For Beginners Page: 1 1. INTRODUCTION TO RDBMS What is DBMS? Data Models Relational database management system (RDBMS) Relational Algebra Structured query language (SQL) What Is DBMS? Data is one
More informationGD3 Database Web Service
GD3 Database Web Service Web Service Guide GD3 Data, LLC Indianapolis, IN www.getdigitaldata.com COPYRIGHT Information in this document is subject to change without notice. Companies, names, and data used
More informationProgramming Database lectures for mathema
Programming Database lectures for mathematics students April 25, 2015 Functions Functions are defined in Postgres with CREATE FUNCTION name(parameter type,...) RETURNS result-type AS $$ function-body $$
More informationDatabase Setup. Coding, Understanding, & Executing the SQL Database Creation Script
Overview @author R.L. Martinez, Ph.D. We need a database to perform the data-related work in the subsequent tutorials. Begin by creating the falconnight database in phpmyadmin using the SQL script below.
More informationDatabase Management System Choices. Introduction To Database Systems CSE 373 Spring 2013
Database Management System Choices Introduction To Database Systems CSE 373 Spring 2013 Outline Introduction PostgreSQL MySQL Microsoft SQL Server Choosing A DBMS NoSQL Introduction There a lot of options
More informationCSE 530A Database Management Systems. Introduction. Washington University Fall 2013
CSE 530A Database Management Systems Introduction Washington University Fall 2013 Overview Time: Mon/Wed 7:00-8:30 PM Location: Crow 206 Instructor: Michael Plezbert TA: Gene Lee Websites: http://classes.engineering.wustl.edu/cse530/
More informationCS2Bh: Current Technologies. Introduction to XML and Relational Databases. Introduction to Databases. Why databases? Why not use XML?
CS2Bh: Current Technologies Introduction to XML and Relational Databases Spring 2005 Introduction to Databases CS2 Spring 2005 (LN5) 1 Why databases? Why not use XML? What is missing from XML: Consistency
More informationZero Downtime Deployments with Database Migrations. Bob Feldbauer twitter: @bobfeldbauer email: bob.feldbauer@timgroup.com
Zero Downtime Deployments with Database Migrations Bob Feldbauer twitter: @bobfeldbauer email: bob.feldbauer@timgroup.com Deployments Two parts to deployment: Application code Database schema changes (migrations,
More informationBrief background What the presentation is meant to cover: Relational, OLTP databases the type that 90% of our applications use
Brief background What the presentation is meant to cover: Relational, OLTP databases the type that 90% of our applications use What s out of scope: Non-relational databases OLAP/decision support data structures,
More informationCSC 443 Data Base Management Systems. Basic SQL
CSC 443 Data Base Management Systems Lecture 6 SQL As A Data Definition Language Basic SQL SQL language Considered one of the major reasons for the commercial success of relational databases SQL Structured
More informationPerformance Tuning for the Teradata Database
Performance Tuning for the Teradata Database Matthew W Froemsdorf Teradata Partner Engineering and Technical Consulting - i - Document Changes Rev. Date Section Comment 1.0 2010-10-26 All Initial document
More informationIT2305 Database Systems I (Compulsory)
Database Systems I (Compulsory) INTRODUCTION This is one of the 4 modules designed for Semester 2 of Bachelor of Information Technology Degree program. CREDITS: 04 LEARNING OUTCOMES On completion of this
More informationConceptual Design Using the Entity-Relationship (ER) Model
Conceptual Design Using the Entity-Relationship (ER) Model Module 5, Lectures 1 and 2 Database Management Systems, R. Ramakrishnan 1 Overview of Database Design Conceptual design: (ER Model is used at
More informationThere are five fields or columns, with names and types as shown above.
3 THE RELATIONAL MODEL Exercise 3.1 Define the following terms: relation schema, relational database schema, domain, attribute, attribute domain, relation instance, relation cardinality, andrelation degree.
More informationExploring Microsoft Office Access 2007. Chapter 2: Relational Databases and Multi-Table Queries
Exploring Microsoft Office Access 2007 Chapter 2: Relational Databases and Multi-Table Queries 1 Objectives Design data Create tables Understand table relationships Share data with Excel Establish table
More information