Modern database systems & their applications Spring 2012 Lecturer: Serafim Dahl
serafim@csc.kth.se
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 1 / 48
Modern database systems & their applications Spring 2012 - - PowerPoint PPT Presentation
Modern database systems & their applications Spring 2012 Lecturer: Serafim Dahl serafim@csc.kth.se DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 1 / 48 General information Course credits 7,5 hp
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 1 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 2 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 3 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 4 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 5 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 6 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 7 / 48
swingGUI applet DBMS DBMS DBMS jdbc esql wrapper
HTTP HTTP RMI/IIOP front−end back−end web browser layer logical RMI/IIOP HTTP/XML RMI/IIOP RMI/IIOP RMI/IIOP
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 8 / 48
Client appl Applet HTML XHTML XML Web server HTTP Sessions Streams Serialization Client tion layer Application layer JSP engine Servlets Servlet engine Data layer JDBC Java Mail JNDI RMI IIOP DB Jini Application server Presenta− Sockets Error log Security manager Connection pool File system Java− Spaces Bean Bean Bean Bean Session beans Entity beans EJB server PHP engine Bean Bean JSP JVM Mail server Catalogue service Java application CORBA application
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 9 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 10 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 11 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 12 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 13 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 14 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 15 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 16 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 17 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 18 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 19 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 20 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 21 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 22 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 23 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 24 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 25 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 26 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 27 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 28 / 48
item name salary manager floor dept department works_on volume supply supplier company address itemno type volume sales
employee
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 29 / 48
Person Staff Client Person Staff Client
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 30 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 31 / 48
admin d d sales eng exec perm hour staff
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 32 / 48
admin d d sales eng exec perm hour staff exec admin
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 33 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 34 / 48
ssn name familyname
jobtype
address amount date salary firstname no pcode street
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 35 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 36 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 37 / 48
locations lname address sex salary minit name fname bdate ssn dependents_of dependent name works_for works_on manages start_date number_of_employees sex birth_date relationship Employee supervision hours name number location project controls department name number N N N N 1 1 1 1 1 1 supevisor supervisee N M
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 38 / 48
the components of composite attributes. Choose one of the keys as primary key. employee (ssn, fname, minit, lname, bdate, address, salary, sex) department (name, number) project (number, name, location)
attribute(s) and skip the identifying relationship type. I place the owner entity type primary key first and rename it for clarity (not necessary). If there are attributes in the identifying relationship type, include them too. dependent (e ssn, name, sex, birth date, relationship)
including all attributes in the relationship type. If one has total participation, treat the relationship type as if it was of type 1:N with the “N-side” in the same direction as the total participation. Normally this minimizes null values (my choise for this example). If neither entity type has total participation you may treat the relationship as if it was of type M:N
department (name, number, m ssn, m start date)
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 39 / 48
relationship type attributes plus the key attribute(s) of the entity type on N-side. Note that we already skipped “dependents of”. If there are more than one candidate key on the 1-side, you have a choice. It is customary to rename some or all included attributes for clarity. employee (ssn, fname, minit, lname, bdate, address, salary, sex, s ssn, d no) project (number, name, location, d no)
types become the key attributes in the base-relation. You may choose which of the candidate/primary keys to use. The chosen key attributes become foreign keys as well. Here we must use CASCADE both for update and delete works on (e ssn, p number, hours)
multivalued attribute itself and the key of the entity type that it belongs to and we also denote the entity type key as a foreign key dept locations (d number, d location) Here we must also use CASCADE both for update and delete
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 40 / 48
attributes, create a base-relation where the surrogate key becomes the primary key and a foreign key in the base-relations that make up the category there are no categories in the model
key attributes from the associated entity types and also make them foreign keys there are no N-ary relationship types in the model Final result employee (ssn, fname, minit, lname, bdate, address, salary, sex, s ssn, d no) department (name, number, m ssn, m start date) project (number, name, location, d no) dependent (e ssn, name, sex, birth date, relationship) works on (e ssn, p number, hours) dept locations(d number, d location) In this simple example we don’t get much more than in a regular ER-model. The only difference is that e ssn in dependent would have been just a foreign key in a regular ER-model and that we cannot get a good result from reverse engineering. But in more complex cases it helps.
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 41 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 42 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 43 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 44 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 45 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 46 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 47 / 48
DD2471 (Lecture 01) Modern database systems & their applications Spring 2012 48 / 48