Download presentation
Presentation is loading. Please wait.
1
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. Example: FK Order(OrderId, …, CustId) Customer(CustId, … ) May 2018 ACS-3902 Yangjun Chen
2
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
3
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
4
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
5
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
6
Person: [PerNo, Lname, Fname, PerBirthDate] ChildOf: [child, parent]
ChildOf: [child, parent] May 2018 ACS-3902 Yangjun Chen
7
Person: 1 John … … 2 Jane 3 Sam 4 Silvia ChildOf: 3 1 2 4 May 2018
ACS-3902 Yangjun Chen
8
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
9
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 DealerId AutoId Price table Dealer Auto sort Total Group by Count show √ criteria >10,000 May 2018 ACS-3902 Yangjun Chen
10
Select lname, Location, Balance From Customer, Branch, Accounts
7. Assume that in a database, we have three tables: Accounts[AID, CountID, BranchID, Balance], Branch[BranchID, manager, Location, Startdate], and Customers[CusID, CountID, fname, lname, Street, City, State]. Use Query Grid to create a query corresponding to the following SQL statement: Select lname, Location, Balance From Customer, Branch, Accounts Where branch.Location = “Campus”. . field lname Location Balance table Customer Branch Accounts sort show √ criteria ”Campus” May 2018 ACS-3902 Yangjun Chen
11
8. (5) List all the different ways to create tables by MS Access.
Answer: - Using Table Wizard - Using data sheet view - Using design view - Creating tables with queries - Creating tables by importing external data sources May 2018 ACS-3902 Yangjun Chen
12
- Field size- Adjusts the size of the text field
9. Explain the meaning of the following properties for attributes. - Field size property - Format property - Input Mask property - Default Value property - Validation Rule property - Caption Answer: - Field size- Adjusts the size of the text field - Format- changes the way field is displayed. Does not effect the value. - Input Mask- facilitates data entry by displaying literals - Default Value- the automatically entered value - Validation Rule- Rejects records that do not conform to rules entered. - Alternate name to be displayed other than the field name. Alternate names appear in datasheets, forms, and reports May 2018 ACS-3902 Yangjun Chen
13
Examples for Format property
Format property for Number data type: #,###.##;(#,###.##)[Red];0,000.00;“Undefined” format for positive number format for 0 format for null-value format for negative number 6,789.77 May 2018 ACS-3902 Yangjun Chen
14
Examples for Input Mask property
Input mask forText data type: !\(999") "000\-0000;0;_ - (204) >!“FJ”\-AA\ – FJ-EA-12048 Input mask for Time data type 99:00:00\ >LL;0;_ - 05:56:00 PM May 2018 ACS-3902 Yangjun Chen
15
Characters that define input masks
explanation User must enter a digit (0 to 9). 9 User can enter a digit (0 to 9). # User can enter a digit, space, plus or minus sign. If skipped, Access enters a blank space. L User must enter a letter. ? User can enter a letter. A User must enter a letter or a digit. a User can enter a letter or a digit. User must enter either a character or a space. & C User can enter characters or spaces. May 2018 ACS-3902 Yangjun Chen
16
Characters that define input masks
explanation . , : ; - / Decimal and thousands placeholders, date and time separators. The character you select depends on your Microsoft Windows regional settings. > Coverts all characters that follow to uppercase. < Converts all characters that follow to lowercase. ! Causes the input mask to fill from left to right instead of from right to left. \ Characters immediately following will be displayed literally. "" Characters enclosed in double quotation marks will be displayed literally. May 2018 ACS-3902 Yangjun Chen
17
10. 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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.