(a) A university is organized into faculties.

Slides:



Advertisements
Similar presentations
Exercise 2 Relational Calculus
Advertisements

Fundamentals of Database Systems Fourth Edition El Masri & Navathe
The Relational Calculus
Database System - Assignment #3 Sept. 2012Yangjun Chen ACS Assignment #3 due Wed., Nov. 14, (30) Exercise 7.17 on Page 235 Show the result.
Defined by Edgar Codd in 1970 Defined by Edgar Codd in 1970 Considered ingenious but impractical Considered ingenious but impractical Conceptually simple.
Jan Yangjun Chen ACS Hierarchical DBMSOutline Hierarchical Database Management Systems Appendix D – 3 rd ed. (Appendix E – 4 th ed. Appendix.
COMPANY schema EMPLOYEE
OUTLINE OF THE LECTURE PART I GOAL: Understand the Data Definition Statements in Fig 4.1 Step1: Columns of the Tables and Data types. Step2: Single column.
1 CSE 480: Database Systems Lecture 22: Query Optimization Reference: Read Chapter 15.6 – 15.8 of the textbook.
The Relational Algebra
Exploring Microsoft Access 2003 Chapter 4 Proficiency: Relational Databases, External Data, Charts, Pivot, and the Switchboard.
Data modeling using the entity-relationship model Sept. 2012Yangjun Chen ACS Outline: Data modeling using ER-model (Chapter 3 - 3rd, 4th, 5th ed.)
Semistructured-Data Model Sept. 2014Yangjun Chen ACS Semistructured-Data Model Semistructured data XML Document type definitions XML schema.
Programming Language for XML Sept. 2014Yangjun Chen ACS Programming Languages for XML XPath XQuery Extensible StyleSheets Language (XSLT)
Review Database Application Development Access Database Development ER-diagram Forms Reports Queries.
Analysis of Midterm-Examination Jan. 2010ACS-7102 Yangjun Chen1 1.(15) Draw an ER-diagram to describe the following real world problem. (a)A university.
Oracle8 - The Complete Reference. Koch & Loney1 Chapter 14. Changing Data: Insert, Update, Delete Presented by Victor M. Matos.
Semi-structured Data. Facts about the Web Growing fast Popular Semi-structured data –Data is presented for ‘human’-processing –Data is often ‘self-describing’
Jyh-haw Yeh Dept. of Computer Science Boise State University
Assignment #3 Sept. 2014Yangjun Chen ACS Assignment #3 Due: Nov. 27, (20) Produce a stylesheet to transform the document shown in Fig. 1(a)
Assignment #2 Sept. 2014Yangjun Chen ACS (20) The following is a DTD for books. Please produce an XML document conforming to the DTD.
관계 연산자 & SQL. Selection SELECT * FROM r WHERE A=B AND D>5.
Logical DB Design 5. 1 CSE2132 Database Systems Week 5 Lecture Logical Database Design.
Review: Application of Database Systems
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 7 Relational Database Design by ER- Mapping.
Relational Algebra - Chapter (7th ed )
Query Processing and Optimization
Retrieve the names of all employees in department 5 who work more than 10 hours per week on the ‘ProductX’ project. p10ssn ← (Π essn (σ hours > 10 (works-on.
 Employee (fname, minit, lname, ssn, bdate, address, sex, salary, superssn, dno)  Department (dname, dnumber, mgrssn, mgrstartdate) 
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
Logical Design database design. Dr. Mohamed Osman Hegaz2 Conceptual Database Designing –Provides concepts that are close to the way many users perceive.
DatabaseDatabase cs453 Lab5 1 Ins.Ebtesam AL-Etowi.
Analysis of Midterm-Examination Oct. 22, 2014ACS-7102 Yangjun Chen1 1.(15) Draw an ER-diagram to describe the following real world problem. (a)A university.
COMP3030 Database Management System Final Review
603 Database Systems Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 11 A First Course in Database Systems.
603 Database Systems Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 9 A First Course in Database Systems.
1Fundamentals of Database Systems 기본키에 밑줄을 그은 COMPANY 관계 데이타베이스 스키마 FNAMEMINITLNAMESSNBDATEADDRESSSEXSALARYSUPERSSNDNO EMPLOYEE DNAMEDNUMBERMGRSSNMGRSTARTDATE.
Mapping ER Diagrams to Tables
603 Database Systems Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 16 A First Course in Database Systems.
Analysis of Midterm-Examination Oct. 21, 2013ACS-7102 Yangjun Chen1 1.(15) Draw an ER-diagram to describe the following real world problem. (a)A university.
Programming Languages for XML
Assignment #1 due Wed. Feb. 15, (15)
Semistructured-Data Model
The SQL Database Grammar
Database Design The Relational Model Text Ch5
Relational Database Design by ER- and EER-to-Relational Mapping
376a. Database Design Dept. of Computer Science Vassar College
Mapping ER Diagrams to Tables
Outline: Relational Data Model
Joining Tables ضم الجداول وإستخراج مناظر views منها الهدف : 1- استخراج المعلومات من جدولين أو اكثر بالإستفادة من الرابط بينهما وبإستخدام SQL 2- شروط قواعد.
Database Index Techniques
Company Requirements.
Outline: Database Basics
CS4222 Principles of Database System
Foreign key (FK) is defined as follows:
Assignment #3 Due: April 03, 2017
Relational Algebra Sample Questions.
Relational Database Design by ER- and EER-to-Relational Mapping
Assignment #2 Due: March 08, 2017
Review: Application of Database Systems
1. Explain the following concepts: (a) superkey (b) key
1.(5) Describe the working process with a database system.
ISC321 Database Systems I Chapter 4: SQL: Data definition, Constraints, and Basic Queries and Updates Fall 2015 Dr. Abdullah Almutairi.
Mapping an ERD to a Relational Database
Assignment #1 Due: Feb. 15, Apply the following algorithm to the B+-tree shown in Fig. 4 to store it in a data file. Trace the computation process.
(a) A university is organized into faculties.
1. Explain the following concepts of the ER data model:
SQL: Set Operations & Nested Queries. Presented by: Dr. Samir Tartir
Answers to Midterm - Exam. Feb. 28, 2018
Answers to Midterm - Exam. Feb. 27, 2006
Presentation transcript:

(a) A university is organized into faculties. 1.(15) Draw an ER-diagram to describe the following real world problem. (a) A university is organized into faculties. (b) Each faculty has a unique name, ID and number of professors and a specific professor is chosen as the faculty head. (c) Each faculty provides a number of courses. (d) Each course has a unique name and courseID. (e) Each professor has a name, SIN, address, salary, sex and courses taught by him/her. (f) Each professor belongs to a faculty and can teach several sections of a course. (g) Each student has a name, ID, SIN, address, GPA, sex, and major. (h) Each student can choose one faculty as his/her major faculty and take several courses with certain credit hours. Some of the courses are mandatory and some are optional. Feb. 27, 2017 ACS-7102 Yangjun Chen

ER-model: professor faculty course section student belong teach head salary name ID addr. SIN belong N 1 professor NoProf F-Id sex F-name M startdate 1 teach section-IDs faculty head 1 L M 1 provide N 1 M course has section sectionId choose N couresId name N ID addr. SIN take M student N major mandatory-optional creditHours name sex birthdate Feb. 27, 2017 ACS-7102 Yangjun Chen

2.(15) Given the following B+-tree, trace the deletion sequence: h, c, e, f. Here, we assume that each internal node can contain at most two keys and each leaf node can contain at most two value/point pairs. c b f a b c e f h Fig. 1 Feb. 27, 2017 ACS-7102 Yangjun Chen

remove h: f e a b c remove c: f e a c b Feb. 27, 2017 ACS-7102 Yangjun Chen ACS-7102 Yangjun Chen 4

remove e: c a e a b f remove f: a e a b f a b a Feb. 27, 2017 ACS-7102 Yangjun Chen

Find the names of employees who works on all the projects 3.(10) Given the relation schemas shown in Fig. 2, construct expressions (using relational algebraic operations) to evaluate the following query: Find the names of employees who works on all the projects controlled by department ‘Applied Computer Science’. EMPLOYEE fname, minit, lname, ssn, bdate, address, sex, salary, superssn, dno DEPARTMENT Dname, dnumber, mgrssn, mgrstartdate Fig. 2 PROJECT WORKS_ON Pname, pnumber, plocation, dnum Essn pno, hours Feb. 27, 2017 ACS-7102 Yangjun Chen

: DN dnumber(Dname = ‘Applied Computer Science’(Department)) DEPT_P PNUMBER(DNDN.dnumber = PROJECT.dnumber(PROJECT)) EMP_PNOS  ESSN,PNO(WORK_ON) SSNS EMP_PNOS : DEPT_P RESULT  FNAME, LNAME(SSNS * EMPLOYEE) Feb. 27, 2017 ACS-7102 Yangjun Chen

4. (20) Construct an R-tree over a set of records for geographical objects with the following coordinates [(x1, y1), (x2, y2)]: [(0, 40), (60, 50)] ---- road1 [(40, 0), (60, 40)] ---- road2 [(15, 25), (35, 35)] ---- house1 [(70, 40), (80, 60)] ---- house2 [(70, 5), (90, 15)] ---- house3 [(80, 60), (100, 80)] ---- house4 Assume that each leaf node can have at most 4 pointers and at least two pointers; and each internal node at most 2 pointers and at least 1 pointer. Please give the computation process. Feb. 27, 2017 ACS-7102 Yangjun Chen

100 house4 house2 road1 house1 house3 road2 100 Feb. 27, 2017 100 Feb. 27, 2017 ACS-7102 Yangjun Chen

((0, 40), (60, 50)) ((0, 0), (60, 50)) road1 road1 road2 [(15, 25), (35, 35)] ---- house1 [(70, 40), (80, 50)] ---- house2 ((0, 0), (60, 50)) ((0, 0), (80, 60)) Road1 road2 house1 Road1 road2 house1 house2 Feb. 27, 2017 ACS-7102 Yangjun Chen

square units to the region. [(70, 5), (80, 15)] ---- house3 ((0, 0), (60, 50)) ((70, 5), (90, 60)) road1 road2 house1 house2 house3 If we expand the first subregion in the internal node, then we add 4000 square units to the region. If we extend the other subregion in the internal, then we add 1200 square units. [(35, 25), (80, 35)] ---- pipeline ((0, 0), (80, 50)) ((70, 5), (100, 80)) road1 road2 house1 house2 house3 house4 Feb. 27, 2017 ACS-7102 Yangjun Chen

5. (15) Please give the algorithm for transforming any XML document to a tree structure. Apply the algorithm to the following document and trace the computation process. <book> <title> “The Art of Programming” </title> <author> “D. Knuth” </author> <year> “1969” </year> </book> <book> <title> <author> <year> “The Art of Programming” “D. Knuth” “1969” Feb. 27, 2017 ACS-7102 Yangjun Chen

Transform an XML document to a tree Read a file into a character array A: < b o o k > < t i t l e > “ T h e A r t … node_value Point_to_node stack S: Feb. 27, 2017 ACS-7102 Yangjun Chen

Transform an XML document to a tree Algorithm: Scan array A; If A[i] is ‘<’ and A[i+1] is a character then { generate a node x for A[i..j], where A[j] is ‘>’ directly after A[i]; let y = S.top().pointer_to_node; make x be a child of y; S.push(A[i..j], x); If A[i] is ‘ ‘‘ ’, then { genearte a node x for A[i..j], where A[j] is ‘ ’’ ’ directly after A[i]; make x be a child of y; If A[i] is ‘<’ and A[i+1] is ‘/’, then S.pop(); Feb. 27, 2017 ACS-7102 Yangjun Chen

<book> <book> <book> <book> <title> “The Art of Programming” </title> <author> “D. Knuth” </author> <year> “1969” </year> </book> <book> <book> <book> <book> <title> <title> <book> <title> The Art of Programming <book> The Art of Programming Feb. 27, 2017 ACS-7102 Yangjun Chen

<author> <book> <book> D. Knuth <year> <title> “The Art of Programming” </title> <author> “D. Knuth” </author> <year> “1969” </year> </book> <book> <author> The Art of Programming <book> The Art of Programming D. Knuth <book> <year> The Art of Programming D. Knuth Feb. 27, 2017 ACS-7102 Yangjun Chen

empty <year> <book> D. Knuth 1969 book title author year “The Art of Programming” </title> <author> “D. Knuth” </author> <year> “1969” </year> </book> <book> <year> The Art of Programming D. Knuth 1969 book The Art of Programming D. Knuth 1969 <book> The Art of Programming D. Knuth 1969 title author year empty Feb. 27, 2017 ACS-7102 Yangjun Chen

6. (15) In order to represent XML documents as relations, we should give each document and each element of a document a unique ID. For each document, the ID could be its URL or path in a file system. A possible relational database schema: DocRoot(docID, rootElmentID) ElementValue(elementID, value) SubElement(parentID, childID, position) ElementAttribute(elementID, name, value)   Please show the tables after we have put the following document into the tables: Feb. 27, 2017 ACS-7102 Yangjun Chen

<? Xml version = “1.0” encoding = “utf-8” standalone = “yes” ?> < md : StarMoviedata xmlns : md = http://infolab.stanford.edu/movies > <Star starID = “cf” starredIn = “sw”> <Name>Carrie Fishes</Name> <Address> <Street>123 Maple St.</Street><City>Hollywood</City> </Address> <Street>5 Locust Ln.</Street><City>Malibu</City> </Star> <Star starID = “mh” starredIn = “sw”> <Name>Mark Hamill</Name><Street>456 Oak Rd.</Street> <City>Brentwood</City> <Movie movieID = “sw” starsOf = “cf mh”> <Title>Star Wars</title><Year>1977</Year> </Movie> </StarMovieData> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 Feb. 27, 2017 ACS-7102 Yangjun Chen

DocRoot(docID, rootElmentID) [1, md: StarMoviedata] [2, Star] [3, Name] [4, “Carrie Fishes”] [5, Address] [6, Street] [7, “123 Maple St.”] [8, City] [9, Hollywood] [10, address] [11, Street] [12, 5 Locus Ln.] [13, City] [14, Malibu] [15, Star] [16, name] [17, Mark Hamill] [18, Street] [19, 456 Oak Rd.] [20, City] [21, Brentwood] [22, Movie] [23, Title] [24, Star wars] [25, Year] [26, 1977] DocRoot(docID, rootElmentID) [1, 1] ElementValue(elementID, value) Feb. 27, 2017 ACS-7102 Yangjun Chen

ElementAttribute(elementID, name, value) [1, xnmns: md, http:// …] [2, starID, “cf”] [2, starredIn, “sw”] [15, starID, “mh”] [15, starredIn, “sw”] [22, movieID, “sw”] [22, starsOf, “cf mh”] SubElement(parentID, childID, position) [1, 2, 1] [1, 15, 2] [1, 22, 3] [2, 3, 1] [2, 5, 2] [2, 10, 3] [3, 4, 1] [5, 6, 1] [5, 8, 2] [6, 7, 1] [8, 9, 1] [10, 11, 1] [10, 13, 2] [11, 12, 1] [13, 14, 1] [15, 16, 1] [15, 18, 2] [15, 20, 3] [16, 17, 1] [18, 19, 1] [20, 21, 1] [22, 23, 1] [22, 25, 2] [23, 24, 1] [25, 26, 1] Feb. 27, 2017 ACS-7102 Yangjun Chen

7. In Fig. 3, we show a network, in which each node stands for a page and each arc for a link from a page to another. Please give the transition matrix for the network. (3) Also, explain why the solution to the equation: (7) A = MA can be used as the estimation of page importance, where A is a vector of n variables (with each representing a page) and M is an n  n transition matrix. Fig. 3 Feb. 27, 2017 ACS-7102 Yangjun Chen

7. (i) p1 p2 p3 ½ ½ ½ ½ 0 ½ M = 0 ½ 0 (ii) y ½ ½ ½ a ½ 0 ½ m = 0 ½ 0 ½ ½ ½ ½ 0 ½ 0 ½ 0 M = (ii) ½ ½ ½ ½ 0 ½ 0 ½ 0 = y a m Feb. 27, 2017 ACS-7102 Yangjun Chen

7. (ii) y: event – navigation stays on Yahoo y-y: event – go to Yahoo from Yahoo y-a: event – go to Yahoo from Amazon y-m: event – go to Yahoo from Microsoft a-y: event – go to Amazon from Yahoo a-a: event – go to Amazon from Amazon a-m: event – go to Amazon from Microsoft a: event – navigation stays on Amazon m-y: event – go to Microsoft from Yahoo m-a: event – go to Microsoft from Amazon m-m: event – go to Microsoft from Microsoft m: event – navigation stays on Microsoft P(y) = P(y-y|y) + P(y-a|a) + P(y-m|m) P(a) = P(a-y|y) + P(a-a|a) + P(a-m|a) P(m) = P(m-y|y) + P(m-a|a) + P(m-m|m) = P(y-y)P(y) + P(y-a)P(a) + P(y-m)P(m) = P(a-y)P(y) + P(a-a)P(a) + P(a-m)P(a) = P(m-y)P(y) + P(m-a)P(a) + P(m-m)P(m) Feb. 27, 2017 ACS-7102 Yangjun Chen