Qa 1
Qa 1
For example, consider a relationship type WORKS_FOR between the two entity
types EMPLOYEE and DEPARTMENT, which associates each employee with the
department for which the employee works. Each relationship instance in the
relationship set WORKS_FOR associates one EMPLOYEE entity and one
DEPARTMENT entity. Figure 3.9 illustrates this example, where each relationship
instance ri is shown connected to the EMPLOYEE and DEPARTMENT entities that
participate in ri. In the mini world represented by Figure 3.9, the employees e1,
e3, and e6 work for department d1; the employees e2 and e4 work for
department d2; and the employees e5 and e7 work for department d3.
Cardinality Ratios for Binary Relationships. The cardinality ratio for a binary
relationship specifies the maximum number of relationship instances that an
entity can participate in. For example, in the WORKS_FOR binary relationship
type, DEPARTMENT: EMPLOYEE is of cardinality ratio 1:N, meaning that each
department can be related to (that is, employs) any number of employees (N),9
but an employee can be related to (work for) at most one department (1). This
means that for this particular relationship type WORKS_FOR, a particular
department entity can be related to any number of employees (N indicates there
is no maximum number). On the other hand, an employee can be related to a
maximum of one department. The possible cardinality ratios for binary
relationship types are 1:1, 1:N, N:1, and M:N.
Participation Constraints and Existence Dependencies:
The participation constraint specifies whether the existence of an entity
depends on its being related to another entity via the relationship type. This
constraint specifies the minimum number of relationship instances that each
entity can participate in and is sometimes called the minimum cardinality
constraint.
There are two types of participation constraints—total and partial.
Let’s consider company database example, If a company policy states that every
employee must work for a department, then an employee entity can exist only
if it participates in at least one WORKS_FOR relationship instance. The
participation of EMPLOYEE in WORKS_FOR is called total participation, meaning
that every entity in the total set of employee entities must be related to a
department entity via WORKS_FOR. Total participation is also called existence
dependency.
12. A database is being constructed to keep track of the teams and games of a
sports league. A team has a number of players, not all of whom participate in
each game. It is desired to keep track of the players participating in each game
for each team, the positions they played in that game, and the result of the
game. Design an ER schema diagram for this application, stating any
assumptions you make. Clearly indicate the cardinality mappings,
participation constraints in your ER diagram. Choose your favourite sport
(e.g., soccer, baseball, football).
Answer :
Assumptions: Each game in the schedule is identified by a unique Game#, and a
game is also identified uniquely by the combination of Date, starting Time, and
Field where it is played. A performance attribute is used to store information on
the individual batting performance of each player in a game. The following
design may be used for a baseball league. Here, we assumed that each game in
the schedule is identified by a unique Game#, and a game is also identified
uniquely by the combination of Date, starting Time, and Field where it is played.
The Performance attribute of PARTICIPATE is used to store information on the
individual performance of each player in a game
13.Discuss the role of a high-level data model in the database design process
Answer:
In the database design process first, we need to collect requirements of the
system and conduct analysis of these requirements. Once the requirements re
validated by customer we can go for software design process and database
design process.
In database design process, we start with conceptual schema for the database,
using a high-level conceptual data model. This step is called conceptual design.
The conceptual schema is a concise description of the data requirements of the
users and includes detailed descriptions of the entity types, relationships, and
constraints; these are expressed using the concepts provided by the high-level
data model. Because these concepts do not include implementation details,
they are usually easier to understand and can be used to communicate with
nontechnical users. The high-level conceptual schema can also be used as a
reference to ensure that all users’ data requirements are met and that the
requirements do not conflict. This approach enables database designers to
concentrate on specifying the properties of the data, without being concerned
with storage and implementation details, which makes it is easier to create a
good conceptual database design.
During or after the conceptual schema design, the basic data model operations
can be used to specify the high-level user queries and operations identified
during functional analysis. This also serves to confirm that the conceptual
schema meets all the identified functional requirements. Modifications to the
conceptual schema can be introduced if some functional requirements cannot
be specified using the initial schema
The next step in database design is the actual implementation of the database,
using a commercial DBMS. Most current commercial DBMSs use an
implementation data model—such as the relational (SQL) model—so the
conceptual schema is transformed from the high-level data model into the
implementation data model. This step is called logical design or data model
mapping; its result is a database schema in the implementation data model of
the DBMS. Data model mapping is often automated or semiautomated within
the database design tools.
The last step is the physical design phase, during which the internal storage
structures, file organizations, indexes, access paths, and physical design
parameters for the database files are specified. In parallel with these activities,
application programs are designed and implemented as database transactions
corresponding to the high-level transaction specifications.
•Database State:
•The actual data stored in a database at a particular moment in time. This
includes the collection of all the data in the database.
•Also called database instance (or occurrence or snapshot).
•The term instance is also applied to individual database components,
e.g. record instance, table instance, entity instance
•Empty State:
•Refers to empty database when the database is first defined.
•Initial Database State:
•Refers to the database state when it is initially loaded into the system.
•Valid State:
A state that satisfies the structure and constraints of the database.
•User-friendly interfaces
•Menu-based, forms-based, graphics-based, etc.
•Mobile Interfaces:interfaces allowing users to perform transactions using
mobile apps
22. What are the different types of Programmer interfaces for embedding DML
in a programming languages
•Embedded Approach: e.g embedded SQL (for C, C++, etc.), SQLJ (for Java)
•Procedure Call Approach: e.g. JDBC for Java, ODBC (Open Database
Connectivity) for other programming languages as API’s (application
programming interfaces)
Client-Server Architectures:
•Print server
•File server
•DBMS server
•Web server
•Email server
•Clients can access the specialized servers as needed
•Client and server must install appropriate client module and server module
software for ODBC or JDBC
•A client program may connect to several DBMSs, sometimes called the data
sources.
•In general, data sources can be files or other non-DBMS software that manages
data.
•Network Model
•Hierarchical Model
•Relational Model
•Object-oriented Data Models
•Object-Relational Models
•Relational Model:
•Proposed in 1970 by E.F. Codd (IBM), first commercial system in 1981-82.
•Now in several commercial products (e.g. DB2, ORACLE, MS SQL Server,
SYBASE, INFORMIX).
•Several free open source implementations, e.g. MySQL, PostgreSQL
•Currently most dominant for developing database applications.
•SQL relational standards: SQL-89 (SQL1), SQL-92 (SQL2), SQL-99, SQL3, …
The above figure shows a simplified overview of the database design process.
The first step shown is requirements collection and analysis. During this step,
the database designers interview prospective database users to understand and
document their data requirements. The result of this step is a concisely written
set of users’ requirements. These requirements should be specified in as
detailed and complete a form as possible. In parallel with specifying the data
requirements, it is useful to specify the known functional requirements of the
application. These consist of the user defined operations (or transactions) that
will be applied to the database, including both retrievals and updates. In
software design, it is common to use data flow diagrams, sequence diagrams,
scenarios, and other techniques to specify functional requirements. We will not
discuss any of these techniques here; they are usually described in detail in
software engineering texts. Once the requirements have been collected and
analyzed, the next step is to create a conceptual schema for the database, using
a high-level conceptual data model. This step is called conceptual design.
During or after the conceptual schema design, the basic data model operations
can be used to specify the high-level user queries and operations identified
during functional analysis. The next step in database design is the actual
implementation of the database, using a commercial DBMS. Most current
commercial DBMSs use an implementation data model—such as the relational
(SQL) model—so the conceptual schema is transformed from the high-level data
model into the implementation data model. This step is called logical design or
data model mapping; its result is a database schema in the implementation data
model of the DBMS. Data model mapping is often automated or semiautomated
within the database design tools. The last step is the physical design phase,
during which the internal storage structures, file organizations, indexes, access
paths, and physical design parameters for the database files are specified. In
parallel with these activities, application programs are designed and
implemented as database transactions corresponding to the high-level
transaction specifications.