You are on page 1of 34

PRACTICAL FILE

ON
“INFORMATION SYSTEM MANAGEMENT”

Submitted in the partial fulfilment for the award of Degree of Bachelor in


Commerce 2019-2022

UNDER THE GUIDANCE: SUBMITTED BY:

MS. Pallavi Sharma SANYAM SINGH

(Assistant Professor) , CPJCHS (01024288819)

Batch No. 2019-2922

CHANDERPRABHU JAIN COLLEGE OF HIGHER STUDIES & SCHOOL OF


LAW

An ISO 9001:2008 Certified Institute (Approved by Govt of NCT of Delhi

(Affiliated to Guru Gobind Singh Indraprastha University, Delhi)

Plot no. OCF Sector A-8, Narela, New Delhi-40

1
INDEX
Introduction To Database…………………………………………………………………3
ER Diagram of Hospital management system……………………………………………13
ER Diagram of Examination system……………………………………………………..16
Create a student table…………………………………………………………………….18
Create a emp info table…………………………………………………………………..19
Display the salary of all employees from emp info table………………………………..21
Display the diff. dept in co. from emp info table………………………………………..22
Display total no. of depts in co. from emp info table……………………………………23
Display the name of emp. Whose name starts with ‘a’………………………………….24
Display the name of emp whose second alphabet is ‘a’…………………………………26
Display id & name of emp who loves in Delhi………………………………………….27
Display id & name of those employees who lives in Delhi/Mumbai…………………...28
Display name & max salary in each department of company……………………….….29
Add Phone No. Column in emp info table………………………………………………30
Update the city of Mr. Vivek from Mumbai to Goa……………………………………32

2
Q1. Introduction to database:
A database is an organized collection of data, generally stored and accessed electronically
from a computer system. It supports the storage and manipulation of data. In other words,
databases are used by an organization as a method of storing, managing and retrieving
information. A database is an organized collection of structured information, or data,
typically stored electronically in a computer system. A database is usually controlled by a
database management system (DBMS). Its file extension is (.def.). Together, the data and the
DBMS, along with the applications that are associated with them, are referred to as a
database system, often shortened to just database.
Formally, a "database" refers to a set of related data and the way it is organized. Access to
this data is usually provided by a "database management system" (DBMS) consisting of an
integrated set of computer software that allows users to interact with one or more databases
and provides access to all of the data contained in the database (although restrictions may
exist that limit access to particular data). The DBMS provides various functions that allow
entry, storage and retrieval of large quantities of information and provides ways to manage
how that information is organized. Because of the close relationship between them, the term
"database" is often used casually to refer to both a database and the DBMS used to
manipulate it.
Outside the world of professional information technology, the term database is often used to
refer to any collection of related data (such as a spreadsheet) as size and usage requirements.
Data within the most common types of databases in operation today is typically modeled in
rows and columns in a series of tables to make processing and data querying efficient. The
data can then be easily accessed, managed, modified, updated, controlled, and organized.
Most databases use structured query language (SQL) for writing and querying data.
In a database, even the smallest portion of information becomes the data. For example, a
Student is a data, a roll number is a data, and the address is data, height, weight, marks
everything is data. In brief, all the living and non-living objects in this world are data. In this
chapter of the database, you will learn about the fundamental terminologies that are used in
DBMS.
Databases and DBMSs can be categorized according to the database model(s) that they
support (such as relational or XML), the type(s) of computer they run on (from a server
cluster to a mobile phone), the query language(s) used to access the database (such as SQL or

3
XQuery), and their internal engineering, which affects performance, scalability, resilience,
and security.
Database Management System (DBMS) is a software for storing and retrieving users' data
while considering appropriate security measures. The name indicates what the database is. A
database is one of the essential components for many applications and is used for storing a
series of data in a single set. It consists of a group of programs which manipulate the
database.

The DBMS accepts the request for data from an application and instructs the operating
system to provide the specific data. In large systems, a DBMS helps users and other third-
party software to store and retrieve data. DBMS allows users to create their own databases as
per their requirement. The term “DBMS” includes the user of the database and other
application programs. It provides an interface between the data and the software application 
Types of Databases:
There are 4 major types of DBMS. Let's look into them in detail.

 Hierarchical - this type of DBMS employs the "parent-child" relationship of storing


data. This type of DBMS is rarely used nowadays. Its structure is like a tree with
nodes representing records and branches representing fields. The windows registry
used in Windows XP is an example of a hierarchical database. Configuration settings
are stored as tree structures with nodes.

 Network DBMS - this type of DBMS supports many-to-many relations. This usually
results in complex database structures. RDM Server is an example of a database
management system that implements the network model.

 Relational DBMS - this type of DBMS defines database relationships in the form of
tables, also known as relations. Unlike network DBMS, RDBMS does not support
many to many relationships. Relational DBMS usually have pre-defined data types
that they can support. This is the most popular DBMS type in the market. Examples
of relational database management systems include MySQL, Oracle, and Microsoft
SQL Server database.

 Object-Oriented DBMS - this type supports the storage of new data types. The data
to be stored is in the form of objects. The objects to be stored in the database have

4
attributes (i.e. gender, ager) and methods that define what to do with the data.
PostgreSQL is an example of an object-oriented relational DBMS.

History :
The emergence of the first type of DBMS, the hierarchical DBMS. IBM had the first model,
developed on IBM 360 and their (DBMS) was called IMS, originally it was written for the
Apollo program. This type of DBMS was based on binary trees, where the shape was like a
tree and relations were only limited between parent and child records. The benefits were
numerous; less redundant data, data independence, security, and integrity, which all lead to
efficient searches. Nonetheless; there were some disadvantages such as; complex
implementation, which was hard to manage because of the absence of standards, which made
it harder to handle many relationships.
 
Before databases existed, everything had to be recorded on paper. We had lists, journals,
ledgers and endless archives containing hundreds of thousands or even millions of records
contained in filing cabinets. When it was necessary to access one of these records, finding
and physically obtaining the record was a slow and laborious task. There were often problems
ranging from misplaced records to fires that wiped out entire archives and destroyed the
history of societies, organizations and governments. There were also security problems
because physical access was often easy to gain.
 

5
The database was created to try and solve these limitations of traditional paper-based
information storage. In databases, the files are called records and the individual data elements
in a record (for example, name, phone number, date of birth) are called fields. The way these
elements are stored has evolved since the early days of databases.
The earliest systems were called the hierarchical and network models.
 
The hierarchical model organized data in a tree-like structure, as shown in fig and IBM
developed this model in the 1960s.

 960: 2 models were in use when the concept of computerized DBMS started. It was at
the same time that the use of computers became the choice for private organizations.
Models used then CODASYL (N/W MODEL) and IMS (IBM’s hierarchical model).
SABRE system by IBM was designed to help American Airlines manage reservations
data.

 1969: IBM introduced its first-ever mainframe machine as System/360.

 1970-72: E.F. Codd published a vital paper stating the use of RDBMS wherein he
mentioned the DB schema being disconnected from the physical information storage;
which then became the gold standard for DBMS1970s: 2 major RDBMS prototypes
were designed viz. INGRES by UBC and System R by IBM San Jose. While INGRES
designed query language QUEL which ultimately resulted in INGRES CORP., MS
SQL SERVER, SYBASE, WANG’S PACE, and BRITTON-LEE; SystemR used the
query language ‘SEQUEL’. This then resulted in the development of SQL/DS, DB2,
Allbase, Oracle and Non-stop SQL.

 1976: ERD also known as entity-relationship diagrams came into play. These were
proposed by P. Chen. They are also known as the conceptual models which focused
more on the data application rather than logical tabular structure.

 1980s: SQL became the standard query language. RDBMS was widely popular and
DB2 became a flagship product by IBM. Later on, the introduction of IBM PCs
further resulted in several new DB companies and products such as RBASE 5000 and
RIM, PARADOX

6
 Early 90s: post DB industry shakeout, surviving companies sold their products as
high prices. Meanwhile, new client tools for developing applications were released.
These included Oracle Developer, VB and PowerBuilder. ODBC prototypes and
Excel/Access were also developed within the same timeframe.

 The Mid 90s: Internet became popular which caused the exponential growth of the
DB industry. More people with average desktops started using client/server systems
for legal data.

 Late 90s: investment in online business resulted in internet DB connectors like


FrontPage, Active Server Pages, Java Servlets, Dream Weaver, Oracle Developer
2000 and Enterprise Java Beans. Use of Apache, MySQL, and other systems
introduced open-source solutions to the Internet. Gradually, online transaction
processing and analytic processing became popular.

 The 2000s: DB applications were not affected by the decline of the internet industry.
Interactive applications for PDAs, point-of-sale transactions and consolidation of
vendors were developed.

 Present: Currently, Microsoft, Oracle, and IBM are the leading companies for
Database Systems.

NEED FOR DBMS:

A Data Base Management System is a system software for easy, efficient and reliable data
processing and management. It can be used for:

1. Processing Queries and Object Management: In traditional file systems, we cannot


store data in the form of objects. In practicalworld applications, data is stored in
objects and not files. So in a file system, some application software maps the data
stored in files to objects so that can be used further. We can directly store data in the
form of objects in a database management system. Application level code needs to be
written to handle, store and scan through the data in a file system whereas a DBMS
gives us the ability to query the database.
2. Controlling redundancy and inconsistency: Redundancy refers to repeated instances
of the same data. A database system provides redundancy control whereas in a file

7
system, same data may be stored multiple times. For example, if a student is studying
two different educational programs in the same college, say, Engineering and History,
then his information such as the phone number and address may be stored multiple
times, once in Engineering dept and the other in History dept. Therefore, it increases
time taken to access and store data. This may also lead to inconsistent data states in
both places. A DBMS uses data normalization to avoid redundancy and duplicates.
3. Access Control and ease in accessing data: A DBMS can grant access to various users
and determine which part and how much of the data can they access from the database
thus removing redundancy. Otherwise in file system, separate files have to be created
for each user containing the amount of data that they can access. Moreover, if a user
has to extract specific data, then he needs a code/application to process that task in
case of file system, e.g. Suppose a manager needs a list of all employees having salary
greater than X. Then we need to write business logic for the same in case data is
stored in files. In case of DBMS, it provides easy access of data through queries, (e.g.,
SELECT queries) and whole logic need not be rewritten. Users can specify exactly
what they want to extract out of the data.
4. Integrity constraints: Data stored in databases must satisfy integrity constraints. For
example, consider a database schema consisting of the various educational programs
offered by a university such as (B. Tech/MTech/B. Sc/M. Sc/BCA/MCA) etc. Then
we have a schema of students enrolled in these programs. A DBMS ensures that it is
only out of one of the programs offered scheme, that the student is enrolled in, i.e. Not
anything out of the blue. Hence, database integrity is preserved.
5. Concurrency control and transaction management: Several applications allow user to
simultaneously access data. This may lead to inconsistency in data in case files are
used. Consider two withdrawal transactions X and Y in which an amount of 100 and
200 is withdrawn from an account A initially containing 1000. Now since these
transactions are taking place simultaneously, different transactions may update the
account differently. X reads 1000, debits 100, updates the account A to 900, whereas
Y also reads 1000, debits 200, updates A to 800. In both cases account A has wrong
information. This results in data inconsistency. A DBMS provides mechanisms to
deal with this kind of data inconsistency while allowing users to access data
concurrently.

8
COMPONENTS OF DBMS:

1. Software:

The main component of a Database management system is the software. It is the set of
programs which is used to manage the database and to control the overall computerized
database.

 The DBMS software provides an easy-to-use interface to store, retrieve, and update
data in the database.
 This software component is capable of understanding the Database Access Language
and converts it into actual database commands to execute or run them on the database.

9
2. Hardware:
 This component of DBMS consists of a set of physical electronic devices such as
computers, I/O channels, storage devices, etc that create an interface between
computers and the users.
 This DBMS component is used for keeping and storing the data in the database.
3. Data:
 It is the most important component of the database management system.
 The main task of DBMS is to process the data. Here, databases are defined,
constructed, and then data is stored, retrieved, and updated to and from the databases.
 The database contains both the metadata (description about data or data about data)
and the actual (or operational) data.
4. Procedures:
 Procedures refer to general rules and instructions that help to design the database and
to use a database management system.
 Procedures are used to setup and install a new database management system (DBMS),
to login and logout of DBMS software, to manage DBMS or application programs, to
take backup of the database, and to change the structure of the database, etc.
5. User:
 The users are the people who control and manage the databases and perform different
types of operations on the databases in the database management system.
 There are three types of users who play different roles in DBMS:
a) Application Programmers
b) Database Administrators
c) End-Users

10
USES OF DBMS:

• Simplified Data Sharing:

A DBMS allows users to easily share the data by following the correct authorization
protocols. It provides operators access to well-managed data. As a result, they can rapidly
respond to variations in the environment.

By using a DBMS, you can yield speedy responses to impromptu queries as the data is
properly managed and up-to-date. In case of any ad hoc query, the database management
software returns a response (known as the query result set) to the application.

• Enhanced Data Safety:

The threats of data security breaches become more pronounced when several users access the
database. A database management software offers better implementation of data
confidentiality and safety guidelines through controlled user access.

. Improved Data Integration:

A DBMS stimulates an integrated view of the company’s data. The company can quickly see
how activities in one division of the organization influence other divisions.

11
• Better Decision-Making:

A database management system provides access to well-managed data, making it possible for
users to make accurate and timely decisions. It offers a streamlined framework to enable data
quality initiatives, improving data management procedures and yielding better-quality
information.

• Improved Efficiency:

Streamlined data access, along with the tools that convert data into valuable information,
enable operators to make swift, knowledgeable decisions. This improves database
performance and efficiency.

ADVANTAGES OF DBMS:
• 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.
• 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.
• 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.
• Data Security:
Data Security is vital concept in a database. Only authorized users should be allowed to
access the database and their identity should be authenticated using a username and
password. Unauthorized users should not be allowed to access the database under any
circumstances as it violates the integrity constraints.

12
• 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.
• 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.
• 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:
• Increased Cost:
a) Cost of Hardware and Software:
This is the first disadvantage of database management system. This is because for DBMS, it
is mandatory to have a high-speed processor and also a large memory size because now a
days there is a large amount of data in every field which needs to be store safely and with a
security.
The requirement of these large amount of space and a high-speed processor needs an
expensive hardware and an expensive software too.
b) Cost of Staff Training:
Educated staff who maintains the database management system also requires good amount.
We need the database system designers to be hired along with application programmers.
Alternatively, the services of some software house need to be taken. So, there is a lot of
money which needs to be spent for developing software.
c) Cost of Data Conversion:
We need to convert our data into database management system, there is a requirement of lot
of money as it adds on to the cost of the database management system. This is because, for

13
this conversion we need to hire database system designers whom we have to pay a lot of
money and also services of some software house will be required.
• Complexity:
As we all know that now a days all companies are using the database management system as
it fulfils lots of requirement and also solves the problem. But a problem arises, that is all
these functionalities has made database management system an extremely complex software.
So, user have proper knowledge before using it.
• Maintenance:
This is very necessary to keep your system current because efficiency which is one of the
biggest factors and need to be overlook must be maximized. That is, we need to maximize the
efficiency of the database system to keep our system current. For this, frequent updating must
be performed on all the components as new threats come daily. DBMS should be updated
according to the current scenario.
• Frequency Upgrade:
Now a days in this world we need to stay up-to-date about the latest technologies,
developments arriving in the market. Frequent upgrade of the products is done by the DBMS
vendors in order to add new functionality to the systems. New upgrade versions of the
software often come bundled. Sometimes these updates also need hardware upgrades.
Sometimes these changes and updates are so fast that the users find it difficult to work with
that system because it is not easy to learn new commands and understand them again when
the new upgrades are done. All these upgrades also cost money in order to train users,
designers etc. to use the new features.

Q2. Make ER Diagram of Hospital Management System.


ENTITY-RELATIONSHIP DIAGRAM (ERD) displays the relationships of entity set stored
in a database. In other words, we can say that ER diagrams help you to explain the logical
structure of databases. At first look, an ER diagram looks very similar to the flowchart.
However, ER Diagram includes many specialized symbols, and its meanings make this
model unique. The purpose of ER Diagram is to represent the entity framework
infrastructure.

Following are some important components of ER Diagram:

Entity: An entity is an object or component of data. An entity is represented as rectangle in


an ER diagram. For eg:
14
Attribute: An attribute describes the property of an entity. An attribute is represented as
Oval in an ER diagram. For eg:

Relationship: A relationship is represented by diamond shape in ER diagram, it shows the


relationship among entities. For eg:

15
This ER Diagram represents the model of Hospital Management System Entity. It shows all
the visual instrument of database tables and the relations between patient, employee, record,
doctor and room etc. It used structure data and to define the relationships between structured
data groups of Hospital Management System functionalities. The entities and attributes are: -
• Patients Entity: Attributes of patients are p-id, p-name, p-address, p-gender and p-
contact-no.
• Room Entity: Attributes are room type, room-id and room-period.
• Employee Entity: Attributes of employees are e-id, e-salary, e-address, e-gender, e-
name and e-contact no.

16
• Medicine Entity: Attributes of medicines are med-price, med-quantity and med-code.

Q3. Make ER Diagram of Examination System.


ENTITY-RELATIONSHIP DIAGRAM (ERD) displays the relationships of entity set stored
in a database. In other words, we can say that ER diagrams help you to explain the logical
structure of databases. At first look, an ER diagram looks very similar to the flowchart.

However, ER Diagram includes many specialized symbols, and its meanings make this
model unique. The purpose of ER Diagram is to represent the entity framework
infrastructure.

Following are some important components of ER Diagram:

Entity: An entity is an object or component of data. An entity is represented as rectangle in


an ER diagram. For eg:

Attribute: An attribute describes the property of an entity. An attribute is represented as


Oval in an ER diagram. For eg:

Relationship: A relationship is represented by diamond shape in ER diagram, it shows the


relationship among entities. For eg:

17
This ER Diagram represents the model of Examination Management System Entity. It shows
all the visual instrument of database tables and the relations between examinations, courses,
students, faculties etc. It used structure data and to define the relationships between structured
data groups of Examination Management System functionalities. The entities and attributes
are: -

• Students Entity: Attributes of students are student id,


student name, student image, student address.
• Examinations Entity: Attributes of examinations are exam id,
exam subject id and exam date.
• Time Table Entity: Attributes of time table are time subject id,
time class id, time period.
• Subject Entity: Attributes of subject are subject name, subject.
• Library Entity: Attributes of library are library name, library address.
• Book Entity: Attributes of book are book id, book name.
• Member Entity: Attributes of member are member name,
member address, member.
• Employee Entity: Attributes of employee are emp name, emp
address, emp id, emp image.
• Teacher Entity: Attributes of teacher are teacher name, teacher
18
address, teacher id, teacher image.
• Class Entity: Attributes of class are class id, class address.

Q4. Create a student table and insert values in it?


Creating a basic table involves naming the table and defining its columns and each column’s
data type.

Syntax: create table (table name) (column1 data type primary key, column2 data type,
column3 data type, column data type);

QUERY: For creating student table the following command is: create table students (id
number (2) primary key, name char (20), age number (3), email varchar (30), class varchar
(5),
address varchar (25));

19
Result:

Q5. Create an emp info and insert values in it?


Creating a basic table involves naming the table and defining its columns and each column’s
data type.

Syntax: create table table name (column1 data type primary key, column2 data type,
column3 data type, column data type);

QUERY: For creating student table the following command is: create table emp info( emp id
number(11) primary key, emp name varchar(20) not null, emp city varchar(10) not null, emp
salary number(30) not null, emp dept varchar(20) not null);

20
Result:

21
Q6. Display the salary of all employees from Emp info table:
First, we have to display the table where all the records are entered for the following
command is: - select * from Emp info; The table will execute with the fields you have
entered.

QUERY: Select emp salary from emp info;


OUTPUT: Here the output will display the salary of all employees from emp info table

Result:

22
Q7. Display the different departments in the company from Emp info
table: First, we have to display the table where all the records are entered for the
following command is: - select * from Emp info;

The table will execute with the fields you have entered.
QUERY: Select emp dept from emp info;
OUTPUT: The output will display departments of all employees from emp info table.

Result:

23
Q8. Display total number of departments in the company from emp info
table:
First, we have to display the table where all the records are entered for the following
command is: - select * from Emp info;
The table will execute with the fields you have entered.
Here we will use an aggregate function: - COUNT() It returns the number rows in a table. It
allows you to count all rows or only rows that match a specified condition.
Syntax: Select Count(column name) from table name;

QUERY: Select Count(emp dept) from emp info;

OUTPUT: Here it will count all the departments which are there in emp info table

Result:

24
Q9. Display the name of employees whose name starts with ‘a’:
Under this Like operator is used to search for a specified pattern in a column. There are 2
wildcards often used in conjunction with the Like operator: %, _

%: Represents zero or more characters.

_: Represents a single character.


We have also used Where clause in this command. Where clause allows you to specify a
search condition for the rows returned by a query. Where clause in select statement is to
filter rows from the result set
Syntax: Select column1, coulmn2, from table name where condition;
QUERY: Select emp name from emp info where emp name like ‘a%’;

OUTPUT: Here the output will show the name of only those employees
whose name starts with ‘A’. Where we have used wildcard: %

25
Result:

26
Q10. Display the name of those employees whose 2nd alphabet is ‘a’:
Under this Like operator is used to search for a specified pattern in a column. There are 2
wildcards often used in conjunction with the Like operator: %, _
%: Represents zero or more characters. _: Represents a single character.
We have also used Where clause in this command. Where clause allows you to specify a
search condition for the rows returned by a query. Where clause in select statement is to
filter rows from the result set.

Syntax: Select column1, column2,.. from table name where condition;

QUERY: Select emp name from emp info where emp name like ‘_a%’;

OUTPUT: Here the output will show the name of only those employees
whose 2nd alphabet is ‘A’. Where we have used both wildcards: %, _

Result:

27
Q11. Display id & name of those employees who lives in Delhi:
Under this Where clause allows you to specify a search condition for the rows returned by a
query. Where clause in select statement is to filter rows from the result set.

QUERY: Select emp id, emp name from emp info where emp city=’Delhi’;
OUTPUT: It will display the id and name of those employees who live in Delhi only.

Result:

28
Q12. Display id & name of those employees who lives in Delhi/Mumbai:
Under this Where clause allows you to specify a search condition for the rows returned by a
query. Where clause in select statement is to filter rows from the result set. We have also
used Or operator which displays a record if any of the conditions separated by Or is True.

Syntax: Select column1, column2,.. From table_name where


condition1 or condition2 or condition3. ;

QUERY: Select emp id, emp name from emp info where emp city=”Delhi” or “Mumbai”;
OUTPUT: It will display the id and name of those employees who lives in Delhi or
Mumbai.

29
Result:

Q13. Display name & max salary in each department of company:

Under this Where clause allows you to specify a search condition for the rows returned by a
query. Where clause in select statement is to filter rows from the result set.

Apart from that MAX() function is also used. It is an aggregate function that returns the
maximum value from an expression.

Syntax: MAX( DISTINCT expression)


QUERY: Select emp name, emp dept from emp info where emp salary=(select max(emp
salary) from emp info);

30
Select emp name, emp dept from emp info where emp salary=(select max(emp salary) from
emp info);
In this query there are 2 statements made together where we have used where clause and max
function. This is an example of Nested query where there are 2 queries: Inner and Outer.
Now, inner query will be executed first and will return the output i.e. it will display the
maximum salary from emp info table which is 72000. And then it will be compared with the
outer query which is: select the emp name and emp dept.
Output: Here it will display the name and department of those employees whose salary is
maximum

Result:

31
Q14. Add Phone No. Column in emp info table:
Here ALTER command is used. It helps to modify an existing database and table. The
ALTER statement is used to “ADD”, “DROP” and “MODIFY” the existing table.
ADD Column: To add column in a table.
Syntax (to add a column): ALTER table table name ADD column name, datatype;
QUERY: Alter table emp info add emp phone No integer (10);
Here a column will be added named as phone number with no values. After that we have
inserted values by using UPDATE statement:-
Update emp info set emp phone number=9910926983 where emp name=’Aadhya’;

32
Result:

Q15. Update the city of Mr. Vivek from Mumbai to Goa:


Here UPDATE statement is used. It helps to modify existing data in a table. Update statement
change values in one or more columns of a single row or multiple rows.
Syntax: UPDATE table name set column1= value where some column= some value.
QUERY: Update emp info set emp city= “Goa” where emp name= “Vivek”

33
Result:

34

You might also like