ERD Flashcards

1
Q

Entity Symbol

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Attribute Symbol

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Relationship Symbol

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Entity

A

An entity can be a person, place, event, or object that is relevant to a given system. For example, a school system may include students, teachers, major courses, subjects, fees, and other items. Entities are represented in ER diagrams by a rectangle and named using singular nouns.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Weak Entity

A

A weak entity is an entity that depends on the existence of another entity. In more technical terms it can defined as an entity that cannot be identified by its own attributes. It uses a foreign key combined with its attributed to form the primary key. An entity like order item is a good example for this. The order item will be meaningless without an order so it depends on the existence of order.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Attribute

A

An attribute is a property, trait, or characteristic of an entity, relationship, or another attribute. For example, the attribute Inventory Item Name is an attribute of the entity Inventory Item. An entity can have as many attributes as necessary.

Meanwhile, attributes can also have their own specific attributes. For example, the attribute “customer address” can have the attributes number, street, city, and state. These are called composite attributes. Note that some top level ER diagrams do not show attributes for the sake of simplicity. In those that do, however, attributes are represented by oval shapes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Multivalued Attribute

A

If an attribute can have more than one value it is called an multivalued attribute. It is important to note that this is different to an attribute having its own attributes. For example a teacher entity can have multiple subject values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Derived Attribute

A

An attribute based on another attribute. This is found rarely in ER diagrams. For example for a circle the area can be derived from the radius.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Relationship

A

A relationship describes how entities interact. For example, the entity “carpenter” may be related to the entity “table” by the relationship “builds” or “makes”. Relationships are represented by diamond shapes and are labeled using verbs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Recursive Relationship

A

If the same entity participates more than once in a relationship it is known as a recursive relationship. In the below example an employee can be a supervisor and be supervised, so there is a recursive relationship.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Cardinality and Ordinality

A

These two further defines relationships between entities by placing the relationship in the context of numbers. In an email system, for example, one account can have multiple contacts. The relationship in this case follows a “one to many” model. There are number of notations used to present cardinality in ER diagrams. Chen, UML, Crow’s foot, Bachman are some of the popular notations. Creately supports Chen, UML and Crow’s foot notations.The following example uses UML to show cardinality.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
A

A Customer has a one-to-many relationship with a Purchase Order because a customer can place many orders, but a given purchase order can be placed by only one customer. The relationship is optional because zero customers might place a given order (it might be placed by someone not previously defined as a customer).

A Purchase Order has a many-to-many relationship with a Stock Item because a purchase order can refer to many stock items, and a stock item can be referred to by many purchase orders. However, you do not know which purchase orders refer to which stock items.

Therefore, you introduce the notion of a Line Item. A Purchase Order has a one-to-many relationship with a Line Item because a purchase order can list many line items, but a given line item can be listed by only one purchase order.

A LineItem has a many-to-one relationship with a StockItem because a line item can refer to only one stock item, but a given stock item can be referred to by many line items. The relationship is optional because zero line items might refer to a given stock item.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

A

One to One

One A is associated with one B.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

A

One to Many

One A is associated with one or more Bs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

A

Many to Many

One or more As are associatd with one or more Bs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

A

One to Zero or One

On A is associated with Zero or one B.

17
Q

A

One to Zero or Many

One A is associated with Zero or many Bs.

Because of the one circle, this means that the relationship is parly optional.

18
Q

A

One to One and One

One A is associated with one B and one C.

19
Q

A

One to One or One

One A is associated with one B or one C (but not both).

20
Q
A

When designing a datbase determine the levels assocaited with the correct number of tables and broken down tables, and FKs and Pks.

21
Q

Create Table Syntax

A

CREATE TABLE Customers

CREATE [COMMAND] TABLE [OBJECT] Customers [Name of Object} (…) [Lines in Table]

23
Q

Create a Table “Customers” with Cust No, Cust Name, Street, City, State, Zip, Phone, PK CustNo

A
CREATE TABLE Customers ( CustNo NUMBER(3) NOT NULL, CustName VARCHAR2(30) NOT NULL, Street VARCHAR2(20) NOT NULL, City VARCHAR2(20) NOT NULL, State CHAR(2) NOT NULL, Zip VARCHAR2(10) NOT NULL, Phone VARCHAR2(12), PRIMARY KEY (CustNo) );