Foreign key (FK) is defined as follows:

Slides:



Advertisements
Similar presentations
Data Modeling (CB 12) CPSC 356 Database Ellen Walker Hiram College (Includes figures from Database Systems by Connolly & Begg, © Addison Wesley 2002)
Advertisements

Database Systems: Design, Implementation, and Management Eighth Edition Chapter 4 Entity Relationship (ER) Modeling.
Mapping an ERD to a Relational Database To map an ERD to a relational database, five rules are defined to govern how tables are constructed. 1)Rule for.
Data modeling using the entity-relationship model Sept. 2012Yangjun Chen ACS Outline: Data modeling using ER-model (Chapter 3 - 3rd, 4th, 5th ed.)
Data Modeling and Relational Database Design ISYS 650.
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.
Exam 2 Review Dr. Bernard Chen Ph.D. University of Central Arkansas.
CS 405G Introduction to Database Systems
Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model Dr. Bernard Chen Ph.D. University of Central Arkansas.
Dr. Mohamed Osman Hegaz1 Conceptual data base design: The conceptual models: The Entity Relationship Model.
Review: Application of Database Systems
Database Management COP4540, SCS, FIU Relational Model Chapter 7.
Chapter 4 Entity Relationship (ER) Modeling.  ER model forms the basis of an ER diagram  ERD represents conceptual database as viewed by end user 
Initial Design of Entity Types for the COMPANY Database Schema Based on the requirements, we can identify four initial entity types in the COMPANY database:
3 & 4 1 Chapters 3 and 4 Drawing ERDs October 16, 2006 Week 3.
CS 405G: Introduction to Database Systems Lecture 2 : Database Design I.
Logical Design database design. Dr. Mohamed Osman Hegaz2 Conceptual Database Designing –Provides concepts that are close to the way many users perceive.
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.
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.
Lecture # 14 Chapter # 5 The Relational Data Model and Relational Database Constraints Database Systems.
IT 5433 LM3 Relational Data Model. Learning Objectives: List the 5 properties of relations List the properties of a candidate key, primary key and foreign.
Entity-Relationship Data Model
Data Modeling Using the Entity- Relationship (ER) Model
Comp 1100 Entity-Relationship (ER) Model
Translating ER Schema to Relational Model
Entity Relationship Model
Let try to identify the conectivity of these entity relationship
CSIS 115 Database Design and Applications for Business
Chapter 3 Data Modeling Using the Entity-Relationship Model
Database Management Systems
Entity- Relationship (ER) Model
ER model Ashima Wadhwa.
RELATION.
Entity-Relationship Model
Tables and Their Characteristics
Chapter -3- Data Modeling Using the Entity-Relationship Model
Database Design – Lecture 4
Entity-Relationship Modeling
Chapter (9) ER and EER-to-Relational Mapping, and other Relational Languages Objectives How a relational database schema can be created from a conceptual.
Lecture # 13 (After 1st Exam)
Lecture3: Data Modeling Using the Entity-Relationship Model.
Chapter (9) ER and EER-to-Relational Mapping, and other Relational Languages Objectives How a relational database schema can be created from a conceptual.
بسم الله الرحمن الرحيم.
Relational Database.
Outline: Database Basics
CS4222 Principles of Database System
Database Systems: Design, Implementation, and Management Tenth Edition
Answer:  Select queries Parameter queries Cross Tab queries
Database Systems Instructor Name: Lecture-9.
Database Modeling using Entity Relationship Model (E-R Model)
(a) A university is organized into faculties.
From data needs to ER Model to relational DB Schema
Foreign key (FK) is defined as follows:
Review: Application of Database Systems
Chapter 4 Entity Relationship (ER) Modeling
Chapter 7: Entity-Relationship Model
1. Explain the following concepts: (a) superkey (b) key
1.(5) Describe the working process with a database system.
Mapping an ERD to a Relational Database
(a) A university is organized into faculties.
1. Explain the following concepts of the ER data model:
Entity Relation Model Tingting Zhang.
Database Management system
Database Management system
Chapter (7) ER-to-Relational Mapping, and other Relational Languages
Entity-Relationship Data Model
Entity Relationship (ER) Modeling
Chapter # 4 Entity Relationship (ER) Modeling.
Mapping an ERD to a Relational Database
Presentation transcript:

Foreign key (FK) is defined as follows: 1. What is a foreign key? What conditions must be satisfied for the values of a foreign key?   Foreign key (FK) is defined as follows: i) Consider two relation schemas R1 and R2; ii) The attributes in FK in R1 have the same domain(s) as the primary key attributes PK in R2; the attributes FK are said to reference or refer to the relation R2; iii) A value of FK in a tuple t1 of the current state r(R1) either occurs as a value of PK for some tuple t2 in the current state r(R2) or is null. In the former case, we have t1[FK] = t2[PK], and we say that the tuple t1 references or refers to the tuple t2. May 2018 ACS-3902 Yangjun Chen

2. Specify the following concepts. Cardinality Constraints   Cardinality Constraints Participation constraints Weak entity Identifying relationship Cardinality is a constraint on a relationship specifying the number of entity instances that a specific entity may be related to via the relationship. Three kinds of cardinality constraints: 1:N, 1:1, M:N May 2018 ACS-3902 Yangjun Chen

The participation constraint specifies whether the existence of an entity depends on its being related to another entity via the relationship type. Two kinds of participation relationships: total (mandatory) and partial (optional)   A weak entity type is an entity type, for which the primary key cannot be recognized. That is, it exists in a relationship to some other entity type. An identifying relationship exists between a weak entity type and its owner. May 2018 ACS-3902 Yangjun Chen

Department: [DeptNo, Manager_fName, Manager_lName] 3. Consider the following ERD. Map the ERD to a relational database showing the relation(s) that will be created (show relation names, attributes, and primary keys). office DeptNo phone fName lName Department Manager Department: [DeptNo, Manager_fName, Manager_lName]   Phone: [DeptNo, phone] Office: [DeptNo, office] May 2018 ACS-3902 Yangjun Chen

4. Consider the following ERD. Person Fname Lname PerBirthDate PerNo Now, consider the recursive relationship “a person is the child of another person”. a) Modify the ERD to accommodate this relationship. b) Show the relations (show the relation name, attributes, and primary key) that exist when you map your ERD in part a) above to a relational database. . May 2018 ACS-3902 Yangjun Chen

Person: [PerNo, Lname, Fname, PerBirthDate] ChildOf: [child, parent]   ChildOf: [child, parent] May 2018 ACS-3902 Yangjun Chen

Person: 1 John … … 2 Jane 3 Sam 4 Silvia ChildOf: 3 1 2 4 May 2018 ACS-3902 Yangjun Chen

5. List all the different types of attributes. Atomic Attributes   Atomic Attributes Composite Attributes Single-valued Attributes Multi-valued Attributes Key Attributes Partial Keys Surrogate Key Non-key Attributes Derived Attributes May 2018 ACS-3902 Yangjun Chen

6. Given the query below, show the corresponding Query Design View. Use an attached sheet for your answer. Assume that Dealer and Auto are two tables. Dealer has attributes: DealerId, and name; and Auto has attributes: AutoId, Make, Model, Year, Price, and Did, where Did is a foreign key referring to DealerId. For each dealer, find the number of the autos with price > 10000, sold by it. field AutoId Make Model Year Price Did table Auto sort   show √ criteria >10,000 May 2018 ACS-3902 Yangjun Chen

7. Consider the following design. Mid Name N wife 1 Marriage Person N husband 1 Pid MDate Map this ERD to a relational database (show relation names, attributes, and primary keys) Person: [Pid, Name] Marriage: [Mid, Mdate, husband, wife] May 2018 ACS-3902 Yangjun Chen

Mandatory: any entity instance take part in the relationship. 8. Explain the difference between two kinds of participation constraints: mandatory and optional.   Mandatory: any entity instance take part in the relationship. Optional: some entity instance take part in the relationship, but some may not. May 2018 ACS-3902 Yangjun Chen

What is a data sheet view? What is a design view? 9. When you work with tables by ACCESS, you need to know the following things: What is a data sheet view? What is a design view? How to set the key for a table? How to establish a relationship between two tables? data sheet view: used to enter data design view: used to design a table structure How to set the key for a table: In the design view, click the corresponding field, and choose ‘primary key’ in the push down menu. How to establish a relationship between two tables: Database Tools  Relationships  show table, and drag one field in one table to another field in some other table. May 2018 ACS-3902 Yangjun Chen

4. 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. May 2018 ACS-3902 Yangjun Chen

ER-model: professor faculty sections course student belong teach head salary name ID addr. SIN belong N 1 professor NoProf F-Id sex F-name M startdate 1 faculty head teach 1 N M 1 sections sectionId provide N M choose has 1 ID course N name addr. SIN N L take M couresId student major mandatory-optional creditHours name sex birthdate May 2018 ACS-3902 Yangjun Chen