0% found this document useful (0 votes)
41 views38 pages

Vocational Skills

The document provides an overview of database concepts, including definitions of data, information, and databases, as well as the need for databases over traditional file systems. It discusses the characteristics, advantages, and disadvantages of Database Management Systems (DBMS), emphasizing data integrity, security, and the ability to handle large amounts of data efficiently. Additionally, it contrasts file management systems with DBMS, highlighting the benefits of using a structured database approach.

Uploaded by

satinder kaur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views38 pages

Vocational Skills

The document provides an overview of database concepts, including definitions of data, information, and databases, as well as the need for databases over traditional file systems. It discusses the characteristics, advantages, and disadvantages of Database Management Systems (DBMS), emphasizing data integrity, security, and the ability to handle large amounts of data efficiently. Additionally, it contrasts file management systems with DBMS, highlighting the benefits of using a structured database approach.

Uploaded by

satinder kaur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

Vocational

Skills
Unit-1:- Database
concepts
Unit-2:- Operating
Web

Satinder kaur
UNIT-1 DATABASE CONCEPTS
DATA
Data is a collection of facts in a raw or unorganized form such as numbers or characters.
Example: Ankit, Delhi, 12, 80.

INFORMATION
Information is data that has been converted into a more useful, meaningful form.
Example: Name – Ankit, City – Delhi, Class – 12, Marks – 80.

DATABASE
The related information when placed in an organized form makes a database. We can organize
related information in the form of files or folders (File based system) or in form of
tables(Relational database).
PROPERTIES OF DATABASE

NEED FOR A DATABASE


1. Size of Data:

The small amount of data storing into spreadsheet is fine, however it might turns into a
large amount of data then Spreadsheet solution will not work. Even if the size of data
records goes into millions then storing data in multiple spreadsheet which will create a
problem of speed. It will take you long time to find a record from the multiple
spreadsheet files.

2. Ease of Updating Data:

Multiple peoples cannot edit the same file on same time. Other peoples must wait until
files are available to update which results into wastage of time.

In a database, it is easy to update data using various Data Manipulation languages (DML)
available

3. Accuracy:

When user doing data entry in files then it might be possible to enter incorrect data due
to no validation present like you can enter wrong spelling, wrong dates, and wrong
amount. So the Data accuracy is hard to maintain and accuracy is in question.

A database is pretty accurate as it has all sorts of build in constraints, checks etc. This means
that the information available in a database is guaranteed to be correct in most cases

4. Security:

You cannot secure the data in the text files and spreadsheet. Anyone can access the file
and read any data present in the file. So storing data will not work with banking,
healthcare application, payroll department where privacy is difficult to maintain.
Databases have various methods to ensure security of data. There are user logins required
before accessing a database and various access specifiers. These allow only authorised users to
access the database.

5. Redundancy:

The duplication of data can be possible using text files or spreadsheet. Chances of
adding multiple copies of data cannot be limited here. This will leads to accuracy issues.
Maintaining and updating multiple copies is not an easy task.

This is ensured in databases by using various constraints for data. Data integrity in databases
makes sure that the data is accurate and consistent in a database.

6. Incomplete Data:

As data files are independent, accessing the information out of multiple files becomes
very difficult. To overcome above problem, associated with storing data in the text file
or spreadsheet the database is required.

Database Management System


A database management system or DBMS is a software used for creating and managing the
data in the database easily and effectively. It is basically a set of programs that allow users to
store, modify/update, and retrieve information from the database as per the requirements.
DBMS also provides security and protection to the database.
DBMS acts as a middle layer between the database and the user.
Database Environment

Example: MySQL, MS SQL Server, Oracle, SQL, DB2, Microsoft Access, etc. are different types of
database management system.

Empolyees are accessing Data through DBMS

VARIOUS OPERATIONS ON DATABASE


There are multiple categories of operations that are performed on a relational database file

The categories are

1. Defining the Database:- Data Definition operations - creating database, files, file groups,
tables, views etc
2. Manipulating the Database:- Data Manipulation operations - Insert, Update, Delete data
from objects
3. Sharing & Protecting the Database:- Data Control operations - GRANT, REVOKE etc
4. Populating the Database:- Transaction Control Operations - ROLLBACK,COMMIT
5. Maintaining the Database:- Database Maintenance Operations - BACKUP, RESTORE,
REBUILD etc

Characteristics of DBMS
There are various characteristics of a database management system, but following are some
important characteristics:
1. Self-Describing Nature

Before DBMS, traditional file management system was used for storing information and data.
There was no concept of definition in traditional file management system like we have in DBMS.
A DBMS should be of Self- Describing nature as it not only contains the database itself but also
the metadata. A metadata (data about data) defines and describes not only the extent, type,
structure and format of all data but also relationship between the data. This data represent
itself that what actions should be taken on it.

2. Support ACID Properties

Any DBMS is able to support ACID (Accuracy, Completeness, Isolation, and Durability)
properties. It is made sure in every DBMS that the real purpose of data should not be lost while
performing transactions like delete, insert and update. Let us take an example; if an employee
name is updated then it should make sure that there is no duplicate data and no mismatch of
employee information.

• Atomicity − This property states that a transaction must be treated as an atomic unit,
that is, either all of its operations are executed or none. There must be no state in a
database where a transaction is left partially completed.
• Consistency − The database must remain in a consistent state after any transaction. No
transaction should have any adverse effect on the data residing in the database
• Durability − The database should be durable enough to hold all its latest updates even
if the system fails or restarts.
• Isolation − In a database system where more than one transaction are being executed
simultaneously and in parallel, the property of isolation states that all the transactions
will be carried out and executed as if it is the only transaction in the system. No
transaction will affect the existence of any other transaction.

3. Concurrent Use of Database

There are many chances that many users will be accessing the data at the same time. They may
require altering the database system concurrently. At that time, DBMS supports them to
concurrently use the database without any problem. For Example, the employees of railway
reservation system can book and access tickets for passengers concurrently. Every employee
can see on his own interface that how many seats are available or bogie is fully booked.

4. Transactions

Transactions are bunch of actions that are done to bring the database from one consistent state
to new consistent state. Traditional file-based system did not have this feature. Transaction is
always atomic that means it can never be further divided. It can only be complete or
incomplete.
For example, A person wants to credit money from his account to another person’s account.
Then transaction will be complete if he sends the money and other guy receives the money.
Anything other than this can lead to an inconsistent transaction.

5. Data Persistence

Persistence means if the data is not removed explicitly then all the data will be maintained in
DBMS. If any system failure happens then life span of data stored in the DBMS will be decided
by the users directly or indirectly. Any data stored in the DBMS can never be lost. If system
failure happens in between any transaction then it will be rolled back or fully completed, but
the data will never be at risk.

6. Backup and recovery

There are many chances of failure of whole database. At that time no one will be able to get the
database back and for sure company will be in a big loss. The only solution is to take backup of
database and whenever it is needed, it can be stored back.

7. Data integrity

This is one of the most important characteristics of database management system. Integrity
ensures the quality and reliability of database system. It protects the unauthorized access of
database and makes it more secure. It brings only the consistence and accurate data into the
database.

8. Multiple Views

Users can have multiple views of database depending on their department and interest. DBMS
support multiple views of database to the users. For example, a user of teaching department
will have different view and user of hostel department will have different. This feature helps
users to have somewhat security because users of other department cannot access their files.

9. Stores any kind of data

A database management system is able to store any kind of data. It should not be restricted to
employee name, salary and address. Any kind of data that exists in the real world can be stored
in DBMS because we need to work with all kinds of data that is present around us.

10. Security

DBMS provides security to the data stored in it because all users have different rights to access
the database. Some of the user can access the whole database while other can access a small
part of database. For example, a computer teacher can only access files that are related to
computer subjects but HOD of the department can access files of all subject that are related to
their department.

11. Represents complex relationship between data

Data stored in a database is connected with each other and a relationship is made in between
data. DBMS is able to represent the complex relationship between data to make efficient and
accurate use of data.

➢ Advantages of DBMS
1. Reducing Data Redundancy

The file based data management systems contained multiple files that were stored in many
different locations in a system or even across multiple systems. Because of this, there were
sometimes multiple copies of the same file which lead to data redundancy.

This is prevented in a database as there is a single database and any change in it is reflected
immediately. Because of this, there is no chance of encountering duplicate data.

2. Sharing of Data

In a database, the users of the database can share the data among themselves. There are
various levels of authorization to access the data, and consequently the data can only be shared
based on the correct authorization protocols being followed.

Many remote users can also access the database simultaneously and share the data between
themselves.

3. Data Integrity

Data integrity means that the data is accurate and consistent in the database. Data Integrity is
very important as there are multiple databases in a DBMS. All of these databases contain data
that is visible to multiple users. So it is necessary to ensure that the data is correct and
consistent in all the databases and for all the users.

4. Data Security

Data Security is vital concept in a database. Only authorised users should be allowed to access
the database and their identity should be authenticated using a username and password.
Unauthorised users should not be allowed to access the database under any circumstances as it
violates the integrity constraints.
5. Privacy

The privacy rule in a database means only the authorized users can access a database according
to its privacy constraints. There are levels of database access and a user can only view the data
he is allowed to. For example - In social networking sites, access constraints are different for
different accounts a user may want to access.

6. Backup and Recovery

Database Management System automatically takes care of backup and recovery. The users
don't need to backup data periodically because this is taken care of by the DBMS. Moreover, it
also restores the database after a crash or system failure to its previous condition.

7. Data Consistency

Data consistency is ensured in a database because there is no data redundancy. All data
appears consistently across the database and the data is same for all the users viewing the
database. Moreover, any changes made to the database are immediately reflected to all the
users and there is no data inconsistency.

➢ Disadvantages of DBMS
1. Cost

DBMS requires high initial investment for hardware, software and trained staff. A significant
investment based upon size and functionality of organization if required. Also organization has
to pay concurrent annual maintenance cost.

2. Complexity

A DBMS fulfill lots of requirement and it solves many problems related to database. But all
these functionality has made DBMS an extremely complex software. Developer, designer, DBA
and End user of database must have complete skills if they want to user it properly. If they
don’t understand this complex system then it may cause loss of data or database failure.

3. Technical staff requirement

Any organization have many employees working for it and they can perform many others tasks
too that are not in their domain but it is not easy for them to work on DBMS. A team of
technical staff is required who understand DBMS and company have to pay handsome salary to
them too.

4. Database Failure
As we know that in DBMS, all the files are stored in single database so chances of database
failure become more. Any accidental failure of component may cause loss of valuable data. This
is really a big question mark for big firms.

5. Extra Cost of Hardware

A DBMS requires disk storage for the data and sometimes you need to purchase extra space to
store your data. Also sometimes you need to a dedicated machine for better performance of
database. These machines and storage space increase extra costs of hardware.

6. Size

As DBMS becomes big software due to its functionalities so it requires lots of space and
memory to run its application efficiently. It gains bigger size as data is fed in it.

7. Cost of Data Conversion

Data conversion may require at any time and organization has to take this step. It is
unbelievable that data conversion cost is more than the costs of DBMS hardware and machine
combined. Trained staff is needed to convert data to new system. It is a key reason that most of
the organizations are still working on their old DBMS due to high cost of data conversion.

8. Maintenance

As new threats comes daily, so DBMS requires to updates itself daily. DBMS should be updates
according to the current scenario.

9. Performance

Traditional files system was very good for small organizations as they give splendid
performance. But DBMS gives poor performance for small scale firms as its speed is slow

➢ Types of user who play different roles in DBMS:

• Application Programmers
• Database Administrators
• End-Users
1. Application Programmers
The users who write the application programs in programming languages (such as Java, C++, or
Visual Basic) to interact with databases are called Application Programmer.

2. Database Administrators (DBA)


A person who manages the overall DBMS is called a database administrator or simply DBA.

3. End-Users
The end-users are those who interact with the database management system to perform
different operations by using the different database commands such as insert, update, retrieve,
and delete on the data, etc.

Applications of DBMS
There are various fields where a database management system is used. Following are some
applications which make use of the database management system:

What is File Management System?

• A file management system is a collection of programs that manage and store data in
files and folders in a computer hard disk.
• A file management system manages the way of reading and writing data to the hard
disk. It is also known as conventional file system.
• This system actually stores data in the isolated files which have their own physical
location on the drive, and users manually go to these locations to access these files. It is
the easiest way to store the data like text, videos, images, audios, etc. in general files.
• Data redundancy is high in file management system, and it cannot be controlled easily.
• Data consistency is not met, and the integration of data is hard to achieve.
• Operating System such as Linux and Windows has its own file system.
For example, NTFS is the Windows file system, and EXT is the Linux file system.
These operating systems provide less security to these files where they have options
such as hide files, locks, and sharing on files.
Difference between File System and Database Management System

There are following differences between file system and DBMS:


File System Database Management System (DBMS)

1. It is a software system used for creating and


1. It is a software system that manages and managing the databases. DBMS provides a
controls the data files in a computer system. systematic way to access, update, and delete
data.

2. File system does not support multi-user 2. Database Management System supports
access. multi-user access.

3. Data consistency is more due to the use of


3. Data consistency is less in the file system.
normalization.

4. Database Management System is highly


4. File system is not secured.
secured.

5. File system is used for storing the 5. Database management system is used for
unstructured data. storing the structured data.

6. In the file system, data redundancy is


6. In DBMS, Data redundancy is low.
high.

7. No data backup and recovery process is


7. There is a backup recovery for data in DBMS.
present in a file system.

8. Handling of a file system is easy. 8. Handling a DBMS is complex.

9. Cost of a file system is less than the 9. Cost of database management system is more
DBMS. than the file system.

10. If one application fails, it does not affect 10. If the database fails, it affects all application
other application in a system. which depends on it.

11. In the file system, data cannot be shared 11. In DBMS, data can be shared as it is stored
because it is distributed in different files. at one place in a database.

12. These system does not provide


12. This system provides concurrency facility.
concurrency facility.

13. Example: NTFS (New technology file 13. Example: Oracle, MySQL, MS SQL Server,
system), EXT (Extended file system), etc. DB2, Microsoft Access, etc.

Relational Database
➢ Relational Model: The relational model represents the database as a collection of
relations. A relation is nothing but a table of values. Every row in the table represents a
collection of related data values. These rows in the table denote a real-world entity or
relationship.

➢ Relational Database: A relational database organizes data into tables which can be linked—or
related—based on data common to each. A database in which the data is stored in the form
of relations (also called tables) is called a Relational Database

➢ RDBMS: A Relational database management system (RDBMS) is a database management


system (DBMS) that is based on the relational model as introduced by E. F. Codd. Some popular
RDBMS software available are: Oracle, MySQL, Sybase.

➢ Properties of RDBMS

• Values are atomic.


• All of the values in a column have the same data type.
• Each row is unique.
• The sequence of columns is insignificant.
• The sequence of rows is insignificant.
• Each column has a unique name.
• Integrity constraints maintain data consistency across multiple tables.

RDBMS TERMINOLOGY

➢ Relation/Table: A table refers to a two dimensional representation of data arranged in


columns (also called fields or attributes) and rows (also called records or tuples).

➢ Column/Field/Attribute: Attributes are the properties which define a relation. A column is a


vertical entity in a table that contains all information associated with a specific field in a table.

For example, a column in the CUSTOMERS table is ADDRESS, which represents location
description and would be as shown below −

+-----------+
| ADDRESS |
+-----------+
| Ahmedabad |
| Delhi |
| Kota |
| Mumbai |
| Bhopal |
| MP |
| Indore |
+----+------+

➢ Row/Record/Tuple – A record is also called as a row of data is each individual entry that
exists in a table. For example, there are 7 records in the above CUSTOMERS table.
Following is a single row of data or record in the CUSTOMERS table −

+----+----------+-----+-----------+----------+
| 1 | Ramesh | 32 | Ahmedabad | 2000.00 |
+----+----------+-----+-----------+----------+

➢ Degree: The total number of attributes in the relation is called the degree of the
relation.

➢ Cardinality: Total number of rows present in the Table.

➢ Entity : Something that exists apart from other things, having its own independent existence

➢ Domain : An attribute is a name paired with a domain (nowadays more commonly referred to
as a type or data type)

➢ Relation schema: The overall structure of table is known as Schema.

In this table, Degree of relation is 3 and cardinality of relation is 3


➢ Database Languages

❖ Data Definition Language

The language is used to create database, tables, alter them, etc. With this, you can also
rename the database, or drop them. It specifies the database schema.

The DDL statements include:

• CREATE: Create new database, table, etc.


• ALTER: Alter existing database, table, etc.(ADD, MODIFY,DROP)
• DROP: Drop the database
• RENAME: Set a new name for the table.

❖ Data Manipulation Language

The language used to manipulate the database like inserting data, updating table,
retrieving record from a table, etc. is known as Data Manipulation Language:

• SELECT: Retrieve data from the database


• INSERT: Insert data
• UPDATE: Update data
• DELETE: Delete all records

❖ Data Control Language

Grant privilege to a user using the GRANT statement. In the same way, revoke the
privilege using the REVOKE statement. Both of these statements come under the Data
Control Language (DCL).:

• GRANT: Give privilege to access the database.


• REVOKE: Take back the privilege to access the database.

❖ Transaction Control Language

Manage transactions in the Database using the Transaction Control Language:

• COMMIT: Save the work.


• SAVEPOINT: Set a point in transaction to rollback later
• ROLLBACK: Restores since last commit
➢ SYNTAX of database commands
❖ DDL

1. CREATE DATABASE databasename;


2. CREATE TABLE table_name (
column1 datatype,
column2 datatype,
column3 datatype,
);
3. ALTER TABLE table_name
ADD column_name datatype;
4. ALTER TABLE table_name
DROP COLUMN column_name;
5. ALTER TABLE table_name
ALTER COLUMN column_name datatype;
6. DROP TABLE table_name;
7. RENAME Old_table_name TO new_table_name;

❖ DML

1. SELECT column1, column2, ...


FROM table_name;
2. SELECT * FROM table_name;
3. SELECT column1, column2, ...
FROM table_name
WHERE condition;
4. INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);
5. INSERT INTO table_name
VALUES (value1, value2, value3, ...);
6. UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
7. DELETE FROM table_name WHERE condition;

❖ DCL
1. GRANT privileges_names ON object TO user;
2. REVOKE privileges ON object FROM user;

❖ TCL
1. COMMIT;
2. ROLLBACK;
3. SAVEPOINT SAVEPOINT_NAME;
4. ROLLBACK TO SAVEPOINT_NAME;

➢ Constraints in RDBMS-

Relational constraints are the restrictions imposed on the database contents and operations. They
ensure the correctness of data in the database.

➢ Types of Constraints in RDBMS

1. Domain Constraint-

Domain constraints are user defined data type. Domain constraints specify that within each
tuple, and the value of each attribute must be unique. This is specified as data types which
include standard data types- integers, real numbers, characters, Booleans, variable length strings,
etc.

we can define them like this:


Domain Constraint = data type + Constraints (NOT NULL / UNIQUE / CHECK / DEFAULT)

❖ CHECK
Using the CHECK constraint we can specify a condition for a field, which should be
satisfied at the time of entering values for this field.
For example, the below query creates a table Student and specifies the condition for the
field AGE as (AGE >= 18). That is, the user will not be allowed to enter any record in the
table with AGE < 18.

CREATE TABLE Student


(
ID int (6) NOT NULL,
NAME varchar(10) NOT NULL,
AGE int NOT NULL CHECK (AGE >= 18)
);

❖ DEFAULT
This constraint is used to provide a default value for the fields. That is, if at the time of
entering new records in the table if the user does not specify any value for these fields
then the default value will be assigned to them.
For example, the below query will create a table named Student and specify the default
value for the field AGE as 18.

CREATE TABLE Student


(
ID int (6) NOT NULL,
NAME varchar(10) NOT NULL,
AGE int DEFAULT 18
);
❖ NOT NULL
If we specify a field in a table to be NOT NULL. Then the field will never accept null
value. That is, you will be not allowed to insert a new row in the table without specifying
any value to this field.
For example, the below query creates a table Student with the fields ID and NAME as
NOT NULL. That is, we are bound to specify values for these two fields every time we
wish to insert a new row.

CREATE TABLE Student


(
ID int(6) NOT NULL,
NAME varchar(10) NOT NULL,
ADDRESS varchar(20)
);

❖ UNIQUE
This constraint helps to uniquely identify each row in the table. i.e. for a particular
column, all the rows should have unique values. We can have more than one UNIQUE
columns in a table.
For example, the below query creates a tale Student where the field ID is specified as
UNIQUE. i.e, no two students can have the same ID.
CREATE TABLE Student
(
ID int(6) NOT NULL UNIQUE,
NAME varchar(10),
ADDRESS varchar(20)
);

2. Entity Integrity constraints

Entity integrity constraint ensures that the primary key attribute in a relation, should not accept a
null value.

❖ PRIMARY KEY
Primary Key is a field which uniquely identifies each row in the table. If a field in a table
as primary key, then the field will not be able to contain NULL values as well as all the
rows should have unique values for this field. So, in other words we can say that this is
combination of NOT NULL and UNIQUE constraints.
A table can have only one field as primary key .Below query will create a table named
Student and specifies the field ID as primary key.

CREATE TABLE Student


(
ID int(6) Primary key,
NAME varchar(10),
ADDRESS varchar(20)
);

3. Referential Integrity Constraints


Referential integrity ensures that the values for a set of attributes in one relation must also appear
the same for the particular set attributes in another relation.

❖ FOREIGN KEY
Foreign Key is a field in a table which uniquely identifies each row of another table. That
is, this field points to primary key of another table. This usually creates a kind of link
between the tables.
Consider the two tables as shown below:

Orders

O_ID ORDER_NO C_ID


1 2253 3
2 3325 3
3 4521 2
4 8532 1

Customers

C_ID NAME ADDRESS


1 RAMESH DELHI
2 SURESH NOIDA
3 DHARMESH GURGAON

As we can see clearly that the field C_ID in Orders table is the primary key in Customers
table, i.e. it uniquely identifies each row in the Customers table. Therefore, it is a Foreign
Key in Orders table.
Syntax:

CREATE TABLE Orders


(
O_ID int NOT NULL,
ORDER_NO int NOT NULL,
C_ID int,
PRIMARY KEY (O_ID),
FOREIGN KEY (C_ID) REFERENCES Customers(C_ID)
);
4. Key Constraint-
An attribute that can uniquely identify a tuple in a relation is called the key of the table. The
value of the attribute for different tuples in the relation has to be unique. First we need to
describe the following terms to understand the concept of key constraint.

❖ Primary Key
❖ Super Key
❖ Candidate Key
❖ Alternate Key
❖ Composite Key
❖ Foreign Key

Keys in DBMS
➢ What is the Super key?

A superkey is a group of single or multiple keys which uniquely identifies rows in a table. A Super key
may have additional attributes that are not needed for unique identification.

Example:

EmpSSN EmpNum Empname


9812345098 AB05 Shown
9876512345 AB06 Roslyn
199937890 AB07 James

In the above-given example, EmpSSN and EmpNum, Empname are superkeys.

➢ What is a Primary Key?

PRIMARY KEY is a column or group of columns in a table that uniquely identify every row in that table.
The Primary Key can't be a duplicate meaning the same value can't appear more than once in the table.
A table cannot have more than one primary key.

Rules for defining Primary key:

• Two rows can't have the same primary key value


• It must for every row to have a primary key value.
• The primary key field cannot be null.
• The value in a primary key column can never be modified or updated if any foreign key refers to
that primary key.

Example:

In the following example, StudID is a Primary Key.

StudID Roll No First Name LastName Email


1 11 Tom Price [email protected]
2 12 Nick Wright [email protected]
3 13 Dana Natan [email protected]

➢ What is the Alternate key?

ALTERNATE KEYS is a column or group of columns in a table that uniquely identify every row in that
table. A table can have multiple choices for a primary key but only one can be set as the primary key. All
the keys which are not primary key are called an Alternate Key.

Example:

In this table, StudID, Roll No, Email are qualified to become a primary key. But since StudID is the
primary key, so Roll No, Email becomes the alternative key.

StudID Roll No First Name LastName Email


1 11 Tom Price [email protected]
2 12 Nick Wright [email protected]
3 13 Dana Natan [email protected]

➢ What is a Candidate Key?

CANDIDATE KEY is a set of attributes that uniquely identify tuples in a table. Candidate Key is a super
key with no repeated attributes. The Primary key should be selected from the candidate keys. Every
table must have at least a single candidate key. A table can have multiple candidate keys but only a
single primary key.

Example: In the given table Stud ID, Roll No, and email are candidate keys which help us to uniquely
identify the student record in the table.

StudID Roll No First Name LastName Email


1 11 Tom Price [email protected]
2 12 Nick Wright [email protected]
3 13 Dana Natan [email protected]
➢ What is the Foreign key?

FOREIGN KEY is a column that creates a relationship between two tables. The purpose of Foreign keys is
to maintain data integrity and allow navigation between two different instances of an entity. It acts as a
cross-reference between two tables as it references the primary key of another table.

Example:

DeptCode DeptName
001 Science
002 English
005 Computer

Teacher ID Fname Lname


B002 David Warner
B017 Sara Joseph
B009 Mike Brunton

In this example, we have two table, teach and department in a school. However, there is no way to see
which search work in which department.

In this table, adding the foreign key in Deptcode to the Teacher name, we can create a relationship
between the two tables.

Teacher ID DeptCode Fname Lname


B002 002 David Warner
B017 002 Sara Joseph
B009 001 Mike Brunton

This concept is also known as Referential Integrity.


➢ What is the Composite key?

COMPOSITE KEY is a combination of two or more columns that uniquely identify rows in a table. The
combination of columns guarantees uniqueness, though individually uniqueness is not guaranteed.
Hence, they are combined to uniquely identify records in a table.

Example:

OrderNo PorductID Product Name Quantity


B005 JAP102459 Mouse 5
B005 DKT321573 USB 10
B005 OMG446789 LCD Monitor 20
B004 DKT321573 USB 15
B002 OMG446789 Laser Printer 3

In this example, OrderNo and ProductID can't be a primary key as it does not uniquely identify a record.
However, a compound key of Order ID and Product ID could be used as it uniquely identified each
record.

➢ Difference Between Primary key & Foreign key

Primary Key Foreign Key


Helps you to uniquely identify a record in the It is a field in the table that is the primary key of
table. another table.
Primary Key never accept null values. A foreign key may accept multiple null values.
Primary key is a clustered index and data in A foreign key cannot automatically create an index,
the DBMS table are physically organized in clustered or non-clustered. However, you can
the sequence of the clustered index. manually create an index on the foreign key.
You can have the single Primary key in a You can have multiple foreign keys in a table.
table.

➢ Difference between Primary Key and Unique Key

Primary Key Unique Key


Unique identifier for rows of a table Unique identifier for rows of a table when primary key is
not present
Cannot be NULL Can be NULL
Only one primary key can be present in a Multiple Unique Keys can be present in a table
table
present in a table present in a table
➢ MySQL
MySQL is an open source SQL database, which is developed by a Swedish company – MySQL AB.
MySQL is pronounced as "my ess-que-ell," in contrast with SQL, pronounced "sequel."

MySQL is supporting many different platforms including Microsoft Windows, the major Linux
distributions, UNIX, and Mac OS X.

MySQL has free and paid versions, depending on its usage (non-commercial/commercial) and
features. MySQL comes with a very fast, multi-threaded, multi-user and robust SQL database server.

History
✓ Development of MySQL by Michael Widenius & David Axmark beginning in 1994.
✓ First internal release on 23rd May 1995.
✓ Windows Version was released on the 8th January 1998 for Windows 95 and NT.
✓ Version 3.23: beta from June 2000, production release January 2001.
✓ Version 4.0: beta from August 2002, production release March 2003 (unions).
✓ Version 4.1: beta from June 2004, production release October 2004.
✓ Version 5.0: beta from March 2005, production release October 2005.
✓ Sun Microsystems acquired MySQL AB on the 26th February 2008.
✓ Version 5.1: production release 27th November 2008.

DATA TYPES
MySQL uses many different data types broken into three categories −

• Numeric
• Date and Time
• String Types.

Numeric Date and Time String


INT DATE CHAR
TINYINT TIME VARCHAR
SMALLINT DATETIME TINYTEXT
MEDIUMINT TIMESTAMP TEXT
BIGINT YEAR BLOB
FLOAT MEDIUMTEXT
DOUBLE MEDIUMBLOB
DECIMAL LONGTEXT
LONGBLOB
ENUM
BOOLEAN
Vocational skills

Unit-2

Operating web

Q1:- What do you mean by web based Applications? Explain the


Online Reservation System with advantages from consumer and
provider point of view?
Web based Applications:- An application that can be accessed via a web browser, over a
network connection is called a web-based application. A web-based application provides
the convenience of availability 24x7 across the world. Nowadays, web-based applications
are used for reservation of tickets and bookings, e-governance, online shopping with the
provision of making payments online using credit/debit cards, and learning using online
tutorials, tests etc. They allow access to the facilities via the Internet from the comfort of
home, office, car, etc

Online Reservation System:- An online reservation system allows booking /cancellation


of tickets through use of Internet. A user can retrieve information and perform
transaction related to reservation of ticket. Some examples of online reservation systems
are:

Airline ticket

Railway ticket

Bus ticket

Movie ticket

Hotel booking

Car rental

Tour and travel booking

Advantages from Consumers point of view


Convenience
One advantage of booking a hotel, flight or car rental online is the convenience.
Being able to make all your travel plans on the Internet means you can do it
any time of the day or night at home, or while you're on your lunch break at the
office. Customers on the go can even make reservations on their smart phones or
tablets.
Prices
User can shop around when making online reservations and choose the best
price. Many hotel and airline websites boast of having the lowest prices and even
offer Internet-only offers for travelers, which are deeply discounted.
Changes and Cancelations
It's simple for travelers to change or cancel online reservations. Instead of calling
the hotel or airline and waiting for a customer service representative to help you
through the process, booking online means user can do it wherever you have
Internet access. Hotels such as the Fairmont (fairmont.com) and the Marriott
(marriott.com) provide
bookings with no cancellation fees, while Virgin America (virginamerica.com)
provides free online changes and cancellations within 24-hours of departure.

Customer Reviews
Making a reservation over the phone or at a travel agency doesn't allow you to
check out what past customers have thought of hotel chains or certain airlines.
Another benefit of making online reservations is being able to see these customer
reviews.

Time Saving
Online reservation consumes very less time in contrast to long queues at the counter.

Discount Scheme
The users can avail the special discount schemes provided by the service provider like, season
discount, advance booking discount and frequent user discount.

Advantages for Providers


Requires Less Staffing

Less man-power is required as every task is done through computers.

No Spatial Restrictions

The organization which is providing online reservation may be operating from the
basement of their house, a garage, an office space in a small building, an office in
a large commercial mall, or an office from their own building. The physical
location of the office does not really matter to a customer who is reserving tickets
online.

Global Access
Online reservation is available to anyone irrespective of their physical location.
The scope of access to the online reservation becomes large as anyone who has
access to the Internet can search for the reservation site and book the tickets.

Precautions while Performing Online Transactions

• Use advanced anti-malware program


• Watch out for security vulnerabilities in PC
• Make sure users are using a secure connection
• Deal with reputed websites only
• Use credit cards for online shopping
• Do not use public computers
• Set a strong and complex password

Q2:- How we can do Online Reservation. Explain with the help of


case study?

For using any online reservation system, we need to do the following:


◆ Open the online reservation website: On your machine having an Internet
connection, open a web browser like Internet Explorer, Google's chrome to open
a website.
◆ If you know the address of the website then type the address in the
address bar, or
◆ If you do not know the address, open a search engine like
google.com or bing.com and search for an online reservation
website. Get the address of the required site. For example, on the
Google Search, you can search for the Air India ticket reservation
site.
◆ Open thewebsite
◆ Browse and search for the required information
◆ Use the website for reservation

Case Study: Book Rail Ticket

◆ Check you have a web browser and an Internet connection on your computer.
◆ Open the browser and type the website address of IRCTC i.e. https://www.irctc.
co.in/ in the address bar. Press <Enter>.
A web page opens

◆ For booking a ticket, you need to have an account on the IRCTC website. If you
already have an account in IRCTC, then type your username and password and
login. If you are not an existing user, you need to create your account. You need
to sign up on the IRCTC website, to perform any transaction.
◆ Create New Account
◆ Locate and click <Signup> link. An individual registration page
opens.
◆ Read the instructions and fill the registration form. The fields
marked with a star (*) are mandatory.
◆ After filling the form, click the <Submit> button.
◆ Once your account has been created, now you can perform
transactions from your account.
◆ For booking a ticket, you need to have an account on the IRCTC website. If you
already have an account in IRCTC, then type your username and password and
login. If you are not an existing user, you need to create your account. You need
to sign up on the IRCTC website, to perform any transaction.
◆ Create New Account
◆ Locate and click <Signup> link. An individual registration page
opens.
◆ Read the instructions and fill the registration form. The fields
marked with a star (*) are mandatory.
◆ After filling the form, click the <Submit> button.
◆ Once your account has been created, now you can perform
transactions from your account.
• Once you have created your account you can login to the site using your
username and password.
• After you login, you can see your page with your name displayed on the right
side of the web page.
• Once your account has been created, now you can perform transactions from
your account.
◆ Book a Ticket
◆ On the Plan My Travel box on the left side of the page, enter the details, i.e.
the start station, end station, date on which you want to travel, ticket type
(e-ticket) and your quota. Next, click on <Find Trains>.
◆ A list of available trains with information about availability of
tickets is displayed.
◆ You can see the train number, train name, departure time, arrival
time at the destination, category of the seats allowed in the train,
like, 1A, 2A, 3A, SL (Sleeper) etc. A cross (x) mark depicts non
availability of that category in the specific train.

◆ Select the category of the seat for a train. A screen appears which
shows the availability of seats in the selected train and selected
category, for the date requested by you and a few days ahead. It
also shows the ticket fare.

◆ After you have checked the fares and you are ready to book a
ticket, click on <book>.

◆ A page as shown in a form appears. Enter the detail of the persons


for whom you are booking the tickets, like, name, age, sex,
berth/seat preference (lower, middle, upper), and check the box, if
you are a senior citizen.

◆ Once you have filled in the details press <enter>, the page showing
your booking details is displayed.

◆ Now, you are required to make payment for the ticket. You can
make payment using credit card, debit card, etc. Once payment is
done, you can view your ticket.

◆ An electronic copy of your paid ticket is shown on the screen. Also,


your ticket will be e-mailed to you at the email address you have
specified in the registration form.

Q3:- What is E-Governance? What are various initiatives taken by Indian government in the field of E-
Governance?

Electronic governance or e-governance is the application of information and communication technology


(ICT) for delivering government services, exchange of information, communication transactions,
integration of various stand-alone systems between government to citizen (G2C), government-to-
business (G2B), government-to-government (G2G), government-to-employees (G2E) as well as back-
office processes and interactions within the entire government framework. Through e-governance,
government services are made available to citizens in a convenient, efficient, and transparent manner.
The three main target groups that can be distinguished in governance concepts are government,
citizens, and businesses/interest groups. In e-governance, there are no distinct boundaries.

To bridge the gap between government and citizens,


to provide effective and efficient services, to increase
productivity and to extend other benefits to its
citizens, the governments of various countries
introduced e-Governance applications. The
applications employ information technology,
telecommunication network incorporating
government policies over internet to serve the citizens better.

The growing importance of governance, spreading its branches in varied fields is going out of control.
This is sprouting up new issues giving raise to the unsuccessful penetration of the e-Governance
applications and is to be controlled. The three major fields of e-Governance applications are
Government to Citizen(G2C), Government to Business(G2B) and Government to Government(G2G). The
citizens are the power of nation and their satisfaction is ultimate.

The government services to citizens should be given utmost importance, as and when it fails resulting in
citizen unrest. The problem of this nature is to be minimized with the proposed basic G2C frame work
which includes the elements of Planning, Social Audit, and Professional Audit, Audits on Facilities,
Performance Audit and Funding. These elements are implemented with quality, security and reliability
following the standards of Six Sigma, Capability Maturity Model Interface (CMMMI) and Bureau of
Indian Standards (BIS).

INITIATIVES

In India, the main thrust for e-Governance was provided by the launching of NICNET in 1987 - the
national satellite-based computer network. This was followed by the launch of the District Information
System of the National Informatics Centre (DISNIC) program to computerize all district offices in the
country for which free hardware and software was offered to the State Governments. NICNET was
extended via the State capitals to all district headquarters by 1990. In the ensuing years,
computerization, tele-connectivity and internet connectivity led to establishment of a large number of
e-Governance initiatives, both at the union and state levels. The formulation of National e-Governance
Plan (NeGP) by the Department of Electronics and Information Technology (DEITY) and Department of
Administrative Reforms and Public Grievances (DAR&PG) in 2006 has boosted the e-Governance
process.

E-Governance Websites

Some of the Central initiatives for e-governance include:

➢ National e-Governance Plan (NeGP)


➢ National e-Governance Division (NeGD)
➢ e-Governance Infrastructure
➢ Mission Mode Projects
➢ Citizens Services
➢ Business Services
➢ Government Services
➢ Projects and Initiatives
➢ R&Din e-Governance

Some of the key e-governance sites of India are as follows:

1. india.gov.in (The National Portal of India):- This is the National Portal of India, which
provides a single window access to information and services being provided by the various
Indian Government entities. The content in this portal is the result of a collaborative effort
of various Indian government ministries and departments, at the central/state/district
level. This portal is Mission Mode Project under the National E-Governance Plan, designed
and maintained by National Informatics Centre (NIC), DeitY, MoCIT, Government of India.
2. goidirectory.nic.in (Government of India Web Directory):- This portal is a one-point source
to access all Indian Government websites at all levels and from all sectors. It includes sites
of different states and union territories of India, sites of government departments like
judiciary and legislature. It also provides information about the various sectors like
education and agriculture.

3. uidai.gov.in:- The Unique Identification Authority of India (UIDAI) is a statutory authority


established under the provisions of the Aadhaar (Targeted Delivery of Financial and Other
Subsidies, Benefits and Services) Act, 2016 (“Aadhaar Act 2016”) on 12 July 2016 by the
Government of India. UIDAI was created with the objective to issue Unique Identification
numbers (UID), named as "Aadhaar", to all residents of India.

4. incometaxindiaefiling.gov.in:- This is the official portal of Income Tax Department, Ministry


of Finance, and Government of India. The portal has been developed as a Mission Mode
Project under the National E-Governance Plan. The objective of this portal is to provide a
single window access to the income tax related services for citizens and other stakeholders.

5. indiapost.gov.in:- The Department of Posts (DoP) has been the backbone of the country’s
communication and has played a crucial role in the country’s social economic development.
It touches the lives of Indian citizens in many ways: delivering mails, accepting deposits
under Small Savings Schemes, providing life insurance cover under Postal Life Insurance
(PLI) and Rural Postal Life Insurance (RPLI) and providing retail services like bill collection,
sale of forms, etc.
Q4:- What is Online shopping? What are the benefits of online shopping? What are the
general outline of the working of an online shopping site?

Online shopping is an e-commerce application where the customer can purchase goods
over the Internet. There are several websites where the customer can go for online
shopping. The customer can purchase all kinds of items, like, books, TV, mobile phones,
dresses, shoes, cosmetics, jewellery and greeting cards. The customer can view the goods
that are displayed along with the details of the goods. The customer can select the goods to
be purchased and store them in their online shopping basket. The payment for the goods is
to be made using debit or credit card. The goods are then delivered at the address specified
by the customer.

Benefits of Online Shopping

Online shopping is useful in many situations. Here, we discuss some of the situations :

➢ The customer does not have enough time to visit a store and purchase goods. To save the time
user prefer online shopping.

➢ The money spent in travelling to the store, parking the car, etc., is much more than
overhead if any in online shopping.

➢ You want to send a product to your friend; you can do online shopping and provide the
receiver's address. You save your time and energy for delivery of the product to your
friend's house located in a different city.

➢ You do not have time during the shopping hours. You can do online shopping from your
office, home, a friend's place, anywhere, any time. Thus there are no fixed shopping
hours.
➢ Online shopping also has bargain offers for the customer delight.
➢ Some online stores allow customers to rate their services and the items. This can be
used to know the quality of service an online store is providing you. You can also know
about the popularity of the item you are purchasing.
➢ Since online shopping involves use of credit card or debit card for payments, and there is
a need to create a user account. The precautions to be taken when doing online
shopping are same as those required during online reservation as discussed in the
earlier sections.

Steps for online shopping are as follows:

➢ Open the shopping site, from where you want to shop online. FIfyoujust want to see the

products and not buy any, you can simply browse the site

➢ If you wish to buy goods, then you may need to create your user account. It requires filling in

a registration form with your details along with a user name and password. For a site, the user

account needs to be created only once. Next time, you can simply login with your username

and password. Some shopping sites may allow you to make a purchase without creating an

account, or allow you to logon using your facebook or google account.

➢ To buy products, login with your user name and password.

➢ Just like you have a shopping basket when you physically go to a shop, online shopping stores
also provide you with a shopping cart or basket. You can select the products that you wish to

buy and add them to your shopping cart.

➢ Having selected your products, you can view what you have selected and the total amount to
be paid by you.

➢ You may delete any product from the shopping cart, or proceed for payment.

➢ Read the terms and conditions before making the payment.

Q5:- Explain the development cycle of web based Application.

A web application is a computer program that uses the web browser and web technology to
perform the task over the internet. A web application is client-server software/application that
run in a web browser. Anyone can use web application from anywhere in the world using
internet connection and web browser.
The process of development of web based applications is broadly categorized in four phases.
During the development process, one needs to follow the following four main phases of
development:

1) Requirements Definition Phase

2) Design Phase

3) Implementation Phase

4) Testing Phase

Requirement Design Implementation Test


Definition

1) Requirement Definition Phase: In this phase we identify the problem statement for
which the web application is to be developed. Identify the scope of the problem. The
following issues need to be addressed in this phase.

(a) Feasibility: Is the project feasible?

(i) Check whether the project is technically feasible (is it possible to do it?).
(ii) Check whether the project is economically feasible (is it profitable?).

(iii) If feasible, proceed further, otherwise there is no need to proceed with the
project.

(b) Scope: The focus is on "what" the application must do. To define the scope of the
application,

(i) Compile a detailed list with a clear description of application features.

(ii) Establish the goals that the solution must achieve.

(iii) Recognizing the limitations that are placed on the project.

2) Design Phase: The focus is on "how" the application is to be designed. This consists of
design of:

A Map of the Web Application Site: It contains essential information about the
structure of the site - the pages and the relationships between them. Thus, we
have a map with pages and a path connecting them. We have to simply
implement the pages and follow the path to connect them.

(b) Database: Design the application database.

(i) Identify the database tables that will be required in the application.

(ii) Decide the table structures: For each table we need to identity the
attributes of the tables, their data types, the size of the columns in the
tables, the relationship between tables.

(c) Page Structure: Design the structure of page.

Identify the main sections of the page like header, main content and sidebar.

3) Implementation Phase: Create backend database, frontend and the


connectivity between them.
a) Backend Database: Create the database and write SQL code defining
tables, attributes and relationships, as per the requirement of the
application.

b) Frontend: Develop the frontend of the application as per the requirement.


Use the Page Structure and the Page Layout you defined in Design phase to
implement the frontend code. Identify the inputs that are required to be
taken from the user in the Front-End of the application. Decide the kind of
buttons you will provide to the user, to minimize the user's typing effort,
like, Radio buttons, checkbox, list and combo box.

c) Data Connectivity: Establish the data connectivity between the Front-End


interface and Back-End Database.

4) Testing Phase: Test the complete application (Front-End and Back-End) with
multiple sample sets of data. Find all the application bugs and fix them. Test
each page of the application and test each feature of the application. Since
fixing an error involves modifying the code, validate the modified code also.
After final validation, the application is ready for release.

You might also like