You are on page 1of 7

Homework Title / No.

: __4_______ Course Code: ___cap 354

Course Instructor: __SUHAS KURDUKAR______

Date of submission: ____07-04-2011_______________

Student’s Roll No.________A26_______________

Section No. : ________a3802_________________

Declaration:
I declare that this assignment is my individual work. I
have not copied from any other student’s work or from any other source
except where due acknowledgment is made explicitly in the text, nor has
any part been written for me by another person.

Student’s Signature :
Amarpreet singh
CAP 354 OPEN STANDARD & TECHNOLOGIES

Q1. Write a short note on following: -

a) Importance of good database design: -

Database design is a very crucial part of development. It is the first step after
requirement gathering and before coding even begins. Taking time to design
the database can save a lot of time and frustration during development.

The importance of a good database design is:

1) Data is in consistent form: -


When the database is designed only relevant and required
data will be stored. The layout of the table allows the data to be consistent.
Other ways to keep the data consistent are through implementation ofprimary keys and
unique key constraints.

Cascading also allows for data consistency. By implementing cascading on a


parent/child table it is ensured that only those child records exist with a valid parent
record.

2) Elimination of redundant data: -


A good database design should be normalized. When
normalization is done data redundancy (or repetition) is reduced, and so is the size of the
database.

3) Simpler queries: -
If the database is well designed the queries will be simple, and
their execution will be fast.

4) Performance: -
The overall performance of the application is also dependent on the
design of the database.

5) Maintenance: -
This is by far the most important issue. A database should be well-
designed so that it is easy to maintain. If it is not, a small change down the road could
cause a lot of stored procedures, functions, views to be effected.

b) Developing Subscription Mechanism: -


Ans : -
You learned in earlier chapters that planning is the most important aspect of creating
any product. In this case, think of the elements you will need for your subscription
mechanism:

• A table to hold email addresses


• A way for users to add or remove their email addresses
• A form and script for sending the message

The following sections describe each item individually.

Creating the subscribers Table: -

You really need only one field in the subscribers table: to hold the email address of the
user. However, you should have an ID field just for consistency among your tables,
and also because referencing an ID is much simpler than referencing a long email
address in where clauses. So, in this case, your MySQL query would look something like

mysql> CREATE TABLE subscribers (


-> id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
-> email VARCHAR (150) UNIQUE NOT NULL
-> );
c) Types of table relationships: -

Ans : -

Table relationships come in several forms:

• One-to-one relationships
• One-to-many relationships
• Many-to-many relationships
1. One-to-One Relationships
• In a one-to-one relationship, a key appears only once in a related table. The
employees and departments tables do not have a one-to-one relationship because
many employees undoubtedly belong to the same department. A one-to-one
relationship exists, for example, if each employee is assigned one computer
within a company. Figure 14.2 shows the one-to-one relationship of employees
to computers.
2. One-to-Many Relationships

In a one-to-many relationship, keys from one table appear multiple times in a related
table. The example shown in Figure 14.1, indicating a connection between employees
and departments, illustrates a one-to-many relationship. A real-world example would
be an organizational chart of the department, as shown in Figure : -

3. Many-to-Many Relationships

The many-to-many relationship often causes problems in practical examples of


normalized databases, so much so that it is common to simply break many-to-many
relationships into a series of one-to-many relationships. In a many-to-many
relationship, the key value of one table can appear many times in a related table. So
far, it sounds like a one-to-many relationship, but here's the curveball: The opposite
is also true, meaning that the primary key from that second table can also appear
many times in the first table.
Q2: - Explain Cookies and Session with merits and demerits.

Ans : -

Merits: -
1. Cookies do not require any server resources since they are stored on the client.
2. Cookies are easy to implement.
3. You can configure cookies to expire when the browser session ends (session
cookies) or they can exist for a specified length of time on the client computer
(persistent cookies).
Demerits: -
1. Users can delete cookies.
2. Users browser can refuse cookies, so your code has to anticipate that possibility.
3. Cookies exist as plain text on the client machine and they may pose a possible
security risk as anyone can open and tamper with cookies.

Merits of Session: -

* It helps to maintain user states and data to all over the application.
* It can easily be implemented and we can store any kind of object.
* Stores every client data separately.
* Session is secure and transparent from user.
Demrits: -

* Performance overhead in case of large volume of user, because of session data


stored in server memory.
* Overhead involved in serializing and De-Serializing session Data. because In case of
StateServer and SQLServer session mode we need to serialize the object before
store.

You might also like