Sie sind auf Seite 1von 12

Question 1

1.1
A database model defines the logical design of data. The model also describes the
relationships between different parts of the data. It determines in which manner data can be
stored, organized, and manipulated.

1. Hierarchical model
In Hierarchical model record types are linked in a treelike structure. The data is stored as
records which are connected to one another through links. A record is a collection of fields,
with each field containing only one value. The entity type of a record defines which fields
the record contains.

Applications
Widely used especially in applications that requires very high performance and availability
such as banking and telecommunications.
E.g.: Windows Registry in the Microsoft Windows operating systems.

2. Network model
The network model is a way of representing objects and their relationships. Hierarchical
model provides single links between set of record. But in network model it provides multiple
links between sets by placing links, or pointers, to one set of records in another

3. Relational model
The relational model is the best known and in todays DBMS most often implemented
database model. It defines a database as a collection of tables (relations) which contain all
data. Most relational databases use the SQL data definition and query language.

4. Entity relationship model


Entity relationship model defines the conceptual view of database. It works around real
world entity and association among them. At view level, ER model is considered well for
designing databases
E-R Model is not SQL based. It's not limited to
any particular DBMS. It is a conceptual and
semantic model captures meanings rather than

an actual implementation. The E-R Model: The enterprise is viewed as set of

Entities
Relationships among entities

Symbols used in E-R Diagram

Entity rectangle
Attribute oval
Relationship diamond
Link - line

5. Enhanced entityrelationship model


The EER model includes all of the concepts introduced by the ER model. Additionally it
includes the concepts of a subclass and superclass (Is-a), along with the concepts of
specialization and generalization. Furthermore, it introduces the concept of a union type or
category, which is used to represent a collection of objects that is the union of objects of
different entity types.
I.

subclass

E.g.: Person may be further grouped into subclass:


Student, Tutor, Coordinator
II.

Superclass

In here Person entity is the superclass


III.

Specialization

Specialization is a process of defining a set of subclasses of an entity type. The set of


subclasses is based upon some distinguishing characteristics of the entities in the
superclass.
IV.

Generalization

Generalization is the reverse of the specialization process Several classes with common
features are generalized into a superclass.
E.g.: Student, Tutor, coordinator generalized in to Person

V.

Union

All of the superclass/subclass relationships have origin from a single superclass.


Sometimes we may need more than one superclass. In this case, the subclass will
represent a collection of objects that is a subset of the UNION of distinct entity types

1.2
The most suitable database model for EdVal Pvt. Ltd is Relational model. Reasons to Use
relational database model,
1. Ease of use:
Both the hierarchical and network models are conceptually simple, but relational model is
simpler than both of those two. The revision of any information as tables consisting of rows
and columns is much easier to understand.

2. Flexibility:
Different tables from which information has to be linked and extracted can be easily
manipulated by operators such as project and join to give information in the form in which it
is desired.
3. Precision:
The usage of relational algebra and relational calculus in the manipulation of the relations
between the tables ensures that there is no ambiguity, which may otherwise arise in
establishing the linkages in a complicated network type database.

4. Security:
Security control and authorization can also be implemented more easily by moving
sensitive attributes in a given table into a separate relation with its own authorization
controls. If authorization requirement permits, a particular attribute could be joined back
with others to enable full information retrieval.

5. Data Independence:
Data independence is achieved more easily with normalization structure used in a relational
database than in the more complicated tree or network structure.

6. Data Manipulation Language:


The possibility of responding to query by means of a language based on relational algebra
and relational calculus e.g SQL is easy in the relational database approach. For data
organized in other structure the query language either becomes complex or extremely
limited in its capabilities.

1.3
A special type of client/server architecture consisting of three well-defined and separate
processes, each running on a different platform: The 3-tier architecture is one which has a
client tier, a middle tier, and a database tier.

Database tier
The database tier manages the database. At this tier, only database resides.
Middle tier
The middle tier contains most of the logic and communicates between the other tiers. At
this tier the application server and program, which access database, resides.
Client tier
The client tier is the interface between the user and the system. At this layer multiple views
of database can be provided by the application. All views are generated by applications,
which reside in application tier.

In this architecture all three tiers are separated onto different computers. Therefore if EdVal
Pvt. Ltd uses the 3 tier architecture it can gain following advantages,
Scalability
This system is used by different users like tutors, students and parents of students over the
Internet. In this architecture the client is only handling presentation logic (UI). Therefore
only little communication is needed between the client and the middle tier. That making the
client thin. An example of a thin client is an Internet browser that allows us to see and
provide information fast and almost with no delay.

Increase performance
This architecture also causes to ensure good performance of the EdVal system. When
more users access the system it reduces the system performance. In 3 tire architecture we
can add as many middle tiers as needed. It ensures the good performance of the system.
Improved Availability
This system performs timed formative test on-line. Use of redundant application servers can
recover from network of server failures.
Maintainability
Because each tier is independent of the other tiers, updates or changes can be carried out
without affecting the application as a whole.
E.g.: can add new courses or change, update coordinator of subject without affecting other
layers.
Reduced Distribution
Changes to business logic only need to be updated on application servers and need not to
distributed on clients
Improved Security
Security is also the best in the three-tier architecture because the middle tier protects the
database tier. Since the client doesnt have direct access to the database, Data layer is
more secure. Business Logic is generally more secure since it is placed on a secured
central server.

1.4
Integrity constraints provide a way of ensuring that changes made to the database by
authorized users do not result in a loss of data consistency.
1. Entity Integrity
Entity integrity defines a row as a unique entity for a particular table. Entity integrity
enforces the integrity of the identifier column(s) or the primary key of a table.
E.g.: In EdVal systems database students and tutors are identified by their national id
number or the passport number.
2. Domain Integrity
Domain integrity means the definition of a valid set of values for an attribute. In a database
system, the domain integrity is defined by:

Data type: Basic data types are integer, decimal, or character. Most data bases
support variants of these plus special data types for date and time.

Length or size: This is the number of digits or characters in the value. For example, a
value of 5 digits or 40 characters.

Is null value allowed: - Indicates whether the attribute can have null values.

Is the value unique or not for an attribute.

These definitions ensure that a specific attribute will have a right and proper value in the
database.
E.g.: Course code consists of three alphabetical letters, year of the study, credit rating and
a serial number.
3. Referential Integrity
Referential integrity preserves the defined relationships between tables when records are
entered or deleted.
E.g.: each subject can have only one coordinator. Coordinator Id is a foreigns key in subject
table.

Question 2
2.1
Assumptions:

1.Student can register only one study program


2. Tutor can teach only one subject

2.2
1. Entity Integrity
Table name

Primary Key

study_program

ID

subject

course_code

coordinator

NID

tutor

NID

student

NID

topics

topic_ID

session

session_ID

unit

unit_ID

2. Domain Integrity
Domain integrity means the definition of a valid set of values for an attribute. In a database
system, the domain integrity is defined by:

Data type: Basic data types are integer, decimal, or character. Most data bases
support variants of these plus special data types for date and time.

Length or size: This is the number of digits or characters in the value. For example, a
value of 5 digits or 40 characters.

Is null value allowed: - Indicates whether the attribute can have null values.

Is the value unique or not for an attribute.

These definitions ensure that a specific attribute will have a right and proper value in the
database.
E.g.: Course code consists of three alphabetical letters, year of the study, credit rating and
a serial number.
3. Referential Integrity
Referential integrity preserves the defined relationships between tables when records are
entered or deleted.
E.g.: Each subject can have only one coordinator
2.3

No Steps

SQL command

CREATE DATABASE edval1

CREATE DATABASE name


edval1

CREATE TABLE `coordinator`

CREATE TABLE `coordinator` (


`coordinator_NID` varchar(10) NOT
NULL,`coordinator_name` varchar(100) NOT
NULL,PRIMARY KEY (`coordinator_NID`))

CREATE TABLE `course`

CREATE TABLE `course` ( `course_code`


varchar(6) NOT NULL,`course_title` varchar(50)
NOT NULL,`coordinator_NID` varchar(11) NOT
NULL,PRIMARY KEY (`course_code`),KEY
`coordinator_NID` (`coordinator_NID`))

CREATE TABLE `session`

CREATE TABLE `session` (`session_ID` int(11)


NOT NULL AUTO_INCREMENT,
`session_name` varchar(30) NOT NULL,
`unit_ID` int(11) NOT NULL, PRIMARY KEY
(`session_ID`), KEY `unit_ID` (`unit_ID`))

CREATE TABLE `student`

CREATE TABLE `student` (`student_name`


varchar(50) NOT NULL, `student_NID`
varchar(10) NOT NULL, `study_program_ID`
int(11) NOT NULL, PRIMARY KEY
(`student_NID`),KEY `study_program_ID`
(`study_program_ID`))

CREATE TABLE

CREATE TABLE `student_evaluation`

`student_evaluation`

`student_NID` varchar(10) NOT NULL, `topic_ID`


int(11) NOT NULL, `marks` int(3) NOT NULL,
PRIMARY KEY (`student_NID`))

CREATE TABLE

CREATE TABLE `study_program` (

`study_program`

`study_program_ID` int(11) NOT NULL


AUTO_INCREMENT, `study_program`
varchar(50) NOT NULL,`course_code` varchar(6)
NOT NULL, PRIMARY KEY
(`study_program_ID`,`study_program`,`course_co
de`)
)
10

CREATE TABLE `topics`

CREATE TABLE `topics` (`topic_ID` int(11) NOT


NULL AUTO_INCREMENT,
`topic_name` varchar(30) NOT NULL,
`session_ID` int(11) NOT NULL,
PRIMARY KEY (`topic_ID`),
KEY `session_ID` (`session_ID`))

CREATE TABLE `tutor`

CREATE TABLE `tutor` (`tutor_NID` varchar(10)


NOT NULL,`Tutor_name` varchar(100) NOT
NULL, `course_code` varchar(6) NOT
NULL,PRIMARY KEY (`tutor_NID`),KEY
`course_code` (`course_code`),CONSTRAINT
`tutor_ibfk_1` FOREIGN KEY (`course_code`)
REFERENCES `course` (`course_code`))

10

CREATE TABLE

CREATE TABLE `tutor_evaluation` ( `tutor_NID`

`tutor_evaluation`

varchar(10) NOT NULL, `student_NID`


varchar(10) NOT NULL, `rating` char(20) NOT
NULL, PRIMARY KEY
(`tutor_NID`,`student_NID`))

11

CREATE TABLE `unit`

CREATE TABLE `unit` (`unit_ID` int(11) NOT


NULL, `unit_name` varchar(50) NOT NULL,
`course_code` varchar(6) NOT NULL,PRIMARY
KEY (`unit_ID`), KEY `course_code`
(`course_code`),CONSTRAINT `unit_ibfk_1`
FOREIGN KEY (`course_code`) REFERENCES
`course` (`course_code`))

2.4

Mysql command to backup system

mysqldump u <username> p<password> <databaseName> > <backupname.sql>

mysqldump u root p edval1 > ECX5240A12013_509064320.sql

11

Das könnte Ihnen auch gefallen