0% found this document useful (0 votes)
54 views31 pages

ISM by Aniket

This document is a practical file submitted by Aniket Kushwaha for the partial fulfillment of a Bachelor of Business Administration degree. It contains an introduction to information system management topics like decision support systems, executive information systems, and transaction processing systems. It also provides overviews of database management systems and key database concepts such as data definition language, data manipulation language, transaction control language, and aggregate functions with examples. The document explains entity relationship diagrams with an example and creates an employee database table to demonstrate aggregate functions. It also provides examples of SQL commands like ALTER, INSERT, UPDATE, and LIKE.

Uploaded by

Aniket Kushwaha
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)
54 views31 pages

ISM by Aniket

This document is a practical file submitted by Aniket Kushwaha for the partial fulfillment of a Bachelor of Business Administration degree. It contains an introduction to information system management topics like decision support systems, executive information systems, and transaction processing systems. It also provides overviews of database management systems and key database concepts such as data definition language, data manipulation language, transaction control language, and aggregate functions with examples. The document explains entity relationship diagrams with an example and creates an employee database table to demonstrate aggregate functions. It also provides examples of SQL commands like ALTER, INSERT, UPDATE, and LIKE.

Uploaded by

Aniket Kushwaha
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/ 31

PRACTICAL FILE

ON
INFORMATION SYSTEM MANAGEMENT-LAB

GURU GOBIND SINGH INDRAPRASTHA UNIVERSITY


In partial fulfilment of the requirement for the award of the degree of

BACHELOR OF BUSINESS ADMINISTRATION


Batch 2020 - 23

SUBMITTED BY: SUBMITTED TO:


ANIKET KUSHWAHA Dr. RAKHI
00650601720 Ms. KOMAL
ASSOCIATE PROFESSOR

NEW DELHI INSTITUTE OF MANAGEMENT


61A, TUGHLAKABAD, NEW DELHI-62

1
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
CERTIFICATE

This is to certify that the practical titled “Information System Management-Lab” submitted by
ANIKET KUSHWAHA to New Delhi Institute of Management, Guru Gobind Singh Indraprastha
University in partial fulfilment of requirement for the award of the Bachelor of Business Administration
degree is an original piece of work carried out under my guidance and may be submitted for evaluation.
The assistance rendered during the study has been duly acknowledged.
No part of this work has been submitted for any other degree.

Place: New Delhi Faculty Guide

Date: Dr. Rakhi & Ms. Komal

2
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
ACKNOWLEDGEMENT

Any accomplishment requires the effort of many people and this work is not different.
Regardless of the source, I wish to express my gratitude to those who may have
contributed to this work, even though anonymously.

I would like to pay my sincere thanks to my Information System Management-Lab


faculty Dr. Rakhi and Ms. Komal under whose guidance I was able to complete my
Practical successfully. I have been fortunate enough to get all the support,
encouragement and guidance from him needed to explore, think new and initiate.

My final thank goes out to my parents, family members, teachers and friends who
encouraged me countless times to persevere through this entire process.

ANIKET KUSHWAHA

3
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
INDEX Page
No.
1 Explain Information System Management.
a. DSS
b. EIS 5-7
c. TPS
2 Introduction of Database Management System. 7
7-8
3 Introduction to the following Concepts.
a. DDL
b. DML
c. TCL
d. Aggregate Function with example 9-18

4 Explain ER D with an Example. 18


18-20

5 Create Employee Table with EMP_ID, EMP_NAME,


EMP_DEPT, EMP_ADDRESS, MOBILE_NUMBER,
EMP_SALARY and then Use Aggregate function by Queries 20-24

6 Write the query for these command 25


• ALTER
• INSERT
• UPDATE 25-30
• LIKE

4
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
1.Explain Information System Management
Information management system A term sometimes used synonymously with database management
system (DBMS) although normally used in a more general sense. The term has no widely accepted
definition and thus can be applied to any system of software that facilitates the storage, organization,
and retrieval of information within a computer system, without the implication that it need have all
the essential characteristics of a DBMS. The information held may include sound fragments, images,
and video sequences in addition to the usual textual and numerical information. These newer forms of
computer-held information are sometimes argued as being a defining characteristic of the term,
notwithstanding that DBMS are developing to provide for such forms of information.

a. DSS (Decision Support System)

A decision support system (DSS) is an information system that aids a business in decision-making
activities that require judgment, determination, and a sequence of actions. The information system
assists the mid- and high-level management of an organization by analysing huge volumes of
unstructured data and accumulating information that can help to solve problems and help in decision-
making. A DSS is either human-powered, automated, or a combination of both.

Purpose of a Decision Support System


A decision support system produces detailed information reports by gathering and analysing data.
Hence, a DSS is different from a normal operations application, whose goal is to collect data and not
analyse it. In an organization, a DSS is used by the planning departments – such as the operations
department – which collects data and creates a report that can be used by managers for decision-
making. Mainly, a DSS is used in sales projection, for inventory and operations-related data, and to
present information to customers in an easy-to-understand manner

Components of a Decision Support System


1. Model Management System
2. User Interface System
3. Knowledge Base

5
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
b. EIS

An executive information system (EIS) is a decision support system (DSS) used to assist senior
executives in the decision-making process. It does this by providing easy access to important data
needed to achieve strategic goals in an organization. An EIS normally features graphical displays on
an easy-to-use interface. Executive information systems can be used in many different types of
organizations to monitor enterprise performance as well as to identify opportunities and problems.
Early executive information systems were developed as computer-based programs on mainframe
computers to provide a company’s description, sales performance and/or market research data for
senior executives. However, senior executives were not all computer literate or confident. Moreover,
EIS data was only supporting executive-level decisions but not necessarily supporting the entire
company or enterprise.
Current EIS data is available company- or enterprise-wide, facilitated by personal computers and
workstations on local area networks (LANs). Employees can access company data to help decision-
making in their individual workplaces, departments, divisions, etc. This allows employees to provide
pertinent information and ideas both above and below their company level. The typical EIS has four
components: hardware, software, user interface and telecommunication.

c. TPS

A transaction process system (TPS) is an information processing system for business transactions
involving the collection, modification and retrieval of all transaction data. Characteristics of a TPS
include performance, reliability and consistency. TPS is also known as transaction processing or real-
time processing. A transaction process system and transaction processing are often contrasted with a
batch process system and batch processing, where many requests are all executed at one time. The
former requires the interaction of a user, whereas batch processing does not require user involvement.
In batch processing the results of each transaction are not immediately available. Additionally, there
is a delay while the many requests are being organized, stored and eventually executed. In transaction
processing there is no delay and the results of each transaction are immediately available. During the
delay time for batch processing, errors can occur. Although errors can occur in transaction
6
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
processing, they are infrequent and tolerated, but do not warrant shutting down the entire system. To
achieve performance, reliability and consistency, data must be readily accessible in a data warehouse,
backup procedures must be in place and the recovery process must be in place to deal with system
failure, human failure, computer viruses, software applications or natural disasters.

2. Introduction of Database Management System


A database management system (DBMS) refers to the technology for creating and managing
databases. DBMS is a software tool to organize (create, retrieve, update, and manage) data in a
database. The main aim of a DBMS is to supply a way to store up and retrieve database information
that is both convenient and efficient. By data, we mean known facts that can be recorded and that
have embedded meaning. Usually, people use software such as DBASE IV or V, Microsoft ACCESS,
or EXCEL to store data in the form of a database. A datum is a unit of data. Meaningful data

7
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
combined to form information. Hence, information is interpreted data - data provided with semantics.
MS. ACCESS is one of the most common examples of database management software.

• Users: Users may be of any kind such as DB administrator, System developer, or database
users.
• Database application: Database application may be Departmental, Personal, organization's
and / or Internal.
• DBMS: Software that allows users to create and manipulate database access,
• Database: Collection of logical data as a single unit.

Where is DBMS used?

• Airlines: reservations, schedules, etc


• Telecom: calls made, customer details, network usage, etc
• Universities: registration, results, grades, etc
• Sales: products, purchases, customers, etc
• Banking: all transactions etc

ADVANTAGE OF DBMS
A DBMS manages data and has many benefits. These are:

• Data independence: Application programs should be as free or independent as possible from


details of data representation and storage. DBMS can supply an abstract view of the data for
insulating application code from such facts.
• Efficient data access: DBMS utilizes a mixture of sophisticated concepts and techniques for
storing and retrieving data competently. This feature becomes important in cases where the
data is stored on external storage devices.
• Data integrity and security: If data is accessed through the DBMS, the DBMS can enforce
integrity constraints on the data.
• Data administration: When several users share the data, integrating the administration of
data can offer significant improvements. Experienced professionals understand the nature of
the data being managed and can be responsible for organizing the data representation to
reduce redundancy and make the data to retrieve efficiently.

8
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
3. Introduction to the following Concepts.
a. DDL (Data Definition Language)
DDL stands for Data Definition Language. It is a language used for defining and modifying the data
and its structure. It is used to build and modify the structure of your tables and other objects in the
database.
DDL commands are as follows,
1. CREATE
2. DROP
3. ALTER
4. RENAME
5. TRUNCATE
These commands can be used to add, remove or modify tables within a database. DDL has pre-
defined syntax for describing the data.

1.CREATE
CREATE command is used for creating objects in the database.
It creates a new table.
Syntax:
CREATE TABLE <table_name>
( column_name1 datatype,
column_name2 datatype,
.
.
.
column_name_n datatype

2. DROP COMMAND

DROP command allows to remove entire database objects from the database. It removes entire data
structure from the database. It deletes a table, index or view.
Syntax:
DROP TABLE <table_name>;
OR
DROP DATABASE <database_name>;

9
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
3. ALTER COMMAND

An ALTER command allows to alter or modify the structure of the database. It modifies an existing
database object. Using this command, you can add additional column, drop existing column and even
change the data type of columns.
Syntax:
ALTER TABLE <table_name>
ADD <column_name datatype>;

OR

ALTER TABLE <table_name>


CHANGE <old_column_name> <new_column_name>;
OR

ALTER TABLE <table_name>


DROP COLUMN <column_name>;

4.RENAME COMMAND

RENAME command is used to rename an object. It renames a database table.


Syntax:
RENAME TABLE <old_name> TO <new_name>;

5.TRUNCATE COMMAND

• TRUNCATE command is used to delete all the rows from the table permanently.
• It removes all the records from a table, including all spaces allocated for the records.
• This command is same as DELETE command, but TRUNCATE command does not generate
any rollback data.
Syntax:
TRUNCATE TABLE <table_name>;

Example:
TRUNCATE TABLE employee;

10
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
b. DML
Introduction to DML
• DML stands for Data Manipulation Language.
• It is a language used for selecting, inserting, deleting and updating data in a database.
• It is used to retrieve and manipulate data in a relational database.
DDL commands are as follows,
1. SELECT
2. INSERT
3. UPDATE
4. DELETE
• DML performs read-only queries of data.

1. SELECT COMMAND

• SELECT command is used to retrieve data from the database.


• This command allows database users to retrieve the specific information they desire from an
operational database.
• It returns a result set of records from one or more tables.

Syntax:
SELECT*FROM<table_name>;

2. INSERT COMMAND

• INSERT command is used for inserting a data into a table.


• Using this command, you can add one or more records to any single table in a database.
• It is also used to add records to an existing code.
Syntax:
INSERT INTO <table_name> (`column_name1` <datatype>, `column_name2` <datatype>, . . . ,
`column_name_n` <database>) VALUES (`value1`, `value2`, . . . , `value n`);

11
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
3. UPDATE COMMAND

• UPDATE command is used to modify the records present in existing table.


• This command updates existing data within a table.
• It changes the data of one or more records in a table.
Syntax:
UPDATE <table_name>
SET <column_name = value>
WHERE condition;

c. TCL
Transaction Control Language (TCL) commands are managed transactions in the database. These are
managed the changes made to the data in a table by DML statements. It also allows statements to be
grouped commonly into logical transactions.

There are some commands of TCL in SQL

• Commit
• Savepoint
• Rollback

Syntax of Commit Command

Commit;

Save-point Command: -

SAVEPOINT command is used to tentatively save a transaction so that you can rollback to that point
whenever needed.

Using this command, we can name the various states of our data in any table and then rollback to that
state using the ROLLBACK command whenever needed.

Syntax of savepoint Command: -

12
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
Savepoint [name of savepint];

Rollback Command: -

This command returns the database to the last committed state. It is also used with the SAVEPOINT
command to jump to a savepoint with its name in a current transaction.

If we have used the UPDATE command to make some modifications into the database, and realize
that those modifications were not required, then we can use the ROLLBACK command to rollback
those modifications, if they were not committed using the COMMIT command.

Syntax of savepoint Command: -

Rollback;

Rollback [name of savepint];

d. Aggregate Function with example

Aggregate Functions in DBMS: Aggregate functions are those functions in the DBMS which takes
the values of multiple rows of a single column and then form a single value by using a query. These
functions allow the user to summarizing the data. These functions ignore the NULL values except the
count function.
In Database Management System, following are the five aggregate functions:
1. AVG
2. COUNT
3. SUM
4. MIN
5. MAX

13
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
1. COUNT FUNCTION

COUNT function is used to Count the number of rows in a database table. It can work on both numeric
and non-numeric data types.

COUNT function uses the COUNT(*) that returns the count of all the rows in a specified table.
COUNT(*) considers duplicate and Null.

Syntax

1. COUNT(*)
2. or
3. COUNT( [ALL|DISTINCT] expression )
4. Sample table:
5. PRODUCT_MAST

PRODUCT COMPANY QTY RATE COST

Item1 Com1 2 10 20

Item2 Com2 3 25 75
14
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
Item3 Com1 2 30 60

Item4 Com3 5 10 50

Item5 Com2 2 20 40

Item6 Cpm1 3 25 75

Item7 Com1 5 30 150

Item8 Com1 3 10 30

Item9 Com2 2 25 50

Item10 Com3 4 30 120

Example: COUNT()

1. SELECT COUNT(*)
2. FROM PRODUCT_MAST;

Output:10

Example: COUNT with WHERE

1. SELECT COUNT(*)
2. FROM PRODUCT_MAST;
3. WHERE RATE>=20;

Output:7

Example: COUNT() with DISTINCT

1. SELECT COUNT(DISTINCT COMPANY)


2. FROM PRODUCT_MAST;

15
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
Output:3

Example: COUNT() with GROUP BY

1. SELECT COMPANY, COUNT(*)


2. FROM PRODUCT_MAST
3. GROUP BY COMPANY;

Output:com1 5

com2 3

Com3 2

Example: COUNT() with HAVING

1. SELECT COMPANY, COUNT(*)


2. FROM PRODUCT_MAST
3. GROUP BY COMPANY
4. HAVING COUNT(*)>2;

Output: com1 5

Com2 3

2. SUM Function

Sum function is used to calculate the sum of all selected columns. It works on numeric fields only.

Syntax

1. SUM()
2. or
3. SUM( [ALL|DISTINCT] expression )

Example: SUM()

1. SELECT SUM(COST)
2. FROM PRODUCT_MAST;
16
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
Output: 670

Example: SUM() with WHERE

1. SELECT SUM(COST)
2. FROM PRODUCT_MAST
3. WHERE QTY>3;

Output: 320

Example: SUM() with GROUP BY

1. SELECT SUM(COST)
2. FROM PRODUCT_MAST
3. WHERE QTY>3
4. GROUP BY COMPANY;

Output: com1 150

Com2 170

Example: SUM() with HAVING

1. SELECT COMPANY, SUM(COST)


2. FROM PRODUCT_MAST
3. GROUP BY COMPANY
4. HAVING SUM(COST)>=170;

Output:com1 335

Com3 170

4. MAX Function

MAX function is used to find the maximum value of a certain column. This function determines the
largest value of all selected values of a column.

Syntax

17
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
1. MAX()
2. or
3. MAX( [ALL|DISTINCT] expression )

Example:

1. SELECT MAX(RATE)
2. FROM PRODUCT_MAST;
Output: 30

5. MIN Function

MIN function is used to find the minimum value of a certain column. This function determines the
smallest value of all selected values of a column.

Syntax

1. MIN()
2. or
3. MIN( [ALL|DISTINCT] expression )

Example:

1. SELECT MIN(RATE)
2. FROM PRODUCT_MAST;

Output: 10

4. Explain ERD with an Example.


Entity Relationship Diagram, also known as ERD is a diagram that displays the relationship of entity
sets stored in a database. In other words, ER diagrams help to explain the logical structure of
databases. ER diagrams are created based on three basic concepts: entities, attributes and
relationships.

18
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
ER Diagrams contain different symbols that use rectangles to represent entities, ovals to define
attributes and diamond shapes to represent relationships.

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.

▪ ER Diagrams Symbols & Notations


It Mainly contains three basic symbols which are rectangle, oval and diamond to represent
relationships between elements, entities and attributes. There are some sub-elements which are based
on main elements in ERD Diagram. ER Diagram is a visual representation of data that describes how
data is related to each other using different ERD Symbols and Notations.

Following are the main components and its symbols in ER Diagrams:

• Rectangles: This Entity Relationship Diagram symbol represents entity type


• Ellipses: Symbol represent attributes
• Diamonds: This symbol represents relationship types
• Lines: It links attributes to entity types and entity types with other relationship types
• Primary key: attributes are underlined
• Double Ellipses: Represent multi-valued attributes

▪ Components of the ER Diagram


This model is based on three basic concepts:

• Entities
• Attributes
• Relationships

19
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
EXAMLE:

• The library management system has a database that shows the relationships between the
entities such as a book, publisher, and member. Since this is a simple system, it has only three
entities. Other systems can be more complex with a more significant number of entities such as
staff etc. book entity can have attributes like book_ID, title, price, and availability. Publisher
entity can have attributes like publisher_ID, publisher_address, and publisher_name. member
entity can have attributes like member_ID, member_date, member_type, member_address,
member_name, and expiry_date.

Entities and Attributes

• Book Entity: It has author, book_ID, title, price, and availability.


• Publisher Entity: It has publisher_ID, publisher_address, and publisher_name.

20
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
• Member Entity: It has member_ID, member_date, member_type, member_address,
member_name, and expiry_date.

5. Create Employee Table with EMP_ID, EMP_NAME, EMP_DEPT,


EMP_ADDRESS, MOBILE_NUMBER, EMP_SALARY and then Use Aggregate
function by Queries

• STEP – 1
• CREATE TABLE EMPLOYEE
• (EMP_ID INT , EMP_NAME VARCHAR(255) , EMP_DEPT VARCHAR(255) ,
EMP_ADDRESS VARCHAR(255), MOBILE_NUMBER INT , EMP_SALARY INT);

• STEP- 2
• INSERT INTO EMPLOYEE
• (EMP_ID, EMP_NAME ,EMP_DEPT, EMP_ADDRESS, MOBILE_NUMBER,
EMP_SALARY)
• VALUES('101', 'Luffy', 'HR', 'Faridabad', '9874354656', '65000');

• STEP- 3 RECORD MORE VALUES .


• FINAL OUTPUT:

21
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
QUERIES FOR THE SAME:

SUM( )
SELECT SUM(EMP_SALARY) from Employee ;

MAX( )
SELECT MAX(EMP_SALARY) from Employee ;

22
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
MIN( )
SELECT MIN(EMP_SALARY) from Employee ;

AVG( )
SELECT AVG(EMP_SALARY) from Employee ;

GROUP BY :
SELECT EMP_NAME,EMP_ID,EMP_SALARY from Employee GROUP BY EMP_NAME;

23
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
COUNT(*):
SELECT EMP_NAME,
COUNT(*) FROM EMPLOYEE GROUP BY EMP_ID ;

UPDATE:
UPDATE EMPLOYEE SET EMP_SALARY = "1000000" WHERE EMP_ID = "104" ;

24
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
LIKE:
SELECT * FROM EMPLOYEE WHERE EMP_NAME LIKE "M%" ;

SELECT *FROM EMPLOYEE WHERE EMP_NAME LIKE "_A%";

DELETE:
DELETE FROM EMPLOYEE WHERE EMP_ID = "104" ;

6.QUERY
1. ALTER COMMAND
Consider the CUSTOMERS table having the following records

| ID | NAME | AGE | ADDRESS | SALARY |


| 1 | Luffy | 32 | GGN | 2000.00 |

25
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
| 2 | Sanji | 25 | Delhi | 1500.00 |
| 3 | Zoro | 23 | Kota | 2000.00 |
| 4 | Nami | 25 | Mumbai | 6500.00 |
| 5 | Hardik | 27 | Bhopal | 8500.00 |
| 6 | Komal | 22 | MP | 4500.00 |
| 7 | Brook | 24 | FBD | 10000.00 |

Syntax
The basic syntax of an ALTER TABLE command to add a New Column in an existing table is as
follows.
ALTER TABLE table_name ADD column_name datatype;
The basic syntax of an ALTER TABLE command to DROP COLUMN in an existing table is as
follows.
ALTER TABLE table_name DROP COLUMN column_name;

EXAMPLE: 1
ALTER TABLE CUSTOMERS ADD SEX char(1);

OUTPUT:
ID | NAME | AGE | ADDRESS | SALARY | SEX |
| 1 | Luffy | 32 | GGN | 2000.00 | NULL |
| 2 | Luffy | 25 | Delhi | 1500.00 | NULL |
| 3 | Zoro | 23 | Kota | 2000.00 | NULL |
| 4 | Zoro | 25 | Mumbai | 6500.00 | NULL |
| 5 | Hardik | 27 | Bhopal | 8500.00 | NULL |
| 6 | Komal | 22 | MP | 4500.00 | NULL |
| 7 | Brook | 24 | FBD | 10000.00 | NULL |

EXAMPLE 2:
ALTER TABLE CUSTOMERS DROP SEX;

OUTPUT:
ID | NAME | AGE | ADDRESS | SALARY
| 1 | Luffy | 32 | GGN | 2000.00 |
| 2 | Luffy | 25 | Delhi | 1500.00 |
| 3 | Zoro | 23 | Kota | 2000.00 |
| 4 | Zoro | 25 | Mumbai | 6500.00 |
| 5 | Hardik | 27 | Bhopal | 8500.00 |
26
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
| 6 | Komal | 22 | MP | 4500.00 |
| 7 | Brook | 24 | FBD | 10000.00 |

2 INSERT COMMAND

Syntax

INSERT INTO TABLE_NAME


(column1, column2, column3,...columnN)
VALUES (value1, value2, value3,...valueN);

EXAMPLE :
INSERT INTO CUSTOMERS (ID,NAME,AGE,ADDRESS,SALARY)
VALUES (1, 'Ramesh', 32, 'GGN', 2000.00 );

INSERT INTO CUSTOMERS (ID,NAME,AGE,ADDRESS,SALARY)


VALUES (2, 'Sanji', 25, 'Delhi', 1500.00 );

INSERT INTO CUSTOMERS (ID,NAME,AGE,ADDRESS,SALARY)


VALUES (3, 'Zoro', 23, 'Kota', 2000.00 );

INSERT INTO CUSTOMERS (ID,NAME,AGE,ADDRESS,SALARY)


VALUES (4, 'Nami', 25, 'Mumbai', 6500.00 );

INSERT INTO CUSTOMERS (ID,NAME,AGE,ADDRESS,SALARY)


VALUES (5, 'Hardik', 27, 'Bhopal', 8500.00 );

INSERT INTO CUSTOMERS (ID,NAME,AGE,ADDRESS,SALARY)


VALUES (6, 'Komal', 22, 'MP', 4500.00 );

OUTPUT:
ID | NAME | AGE | ADDRESS | SALARY |
| 1 | Luffy | 32 | GGN | 2000.00 |
| 2 | Sanji | 25 | Delhi | 1500.00 |
| 3 | Zoro | 23 | Kota | 2000.00 |
| 4 | Nami | 25 | Mumbai | 6500.00 |
| 5 | Hardik | 27 | Bhopal | 8500.00 |

27
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
| 6 | Komal | 22 | MP | 4500.00 |

3 UPDATE COMMAND

Consider the CUSTOMERS table having the following records −


ID | NAME | AGE | ADDRESS | SALARY |
| 1 | Luffy | 32 | GGN | 2000.00 |
| 2 | Sanji | 25 | Delhi | 1500.00 |
| 3 | Zoro | 23 | Kota | 2000.00 |
| 4 | Nami | 25 | Mumbai | 6500.00 |
| 5 | Hardik | 27 | Bhopal | 8500.00 |
| 6 | Komal | 22 | MP | 4500.00 |
| 7 | Brook | 24 | FBD | 10000.00

Syntax:
The basic syntax of the UPDATE query with a WHERE clause is as follows −
UPDATE table_name
SET column1 = value1, column2 = value2...., columnN = valueN
WHERE [condition];

EXAMPLE:

UPDATE CUSTOMERS
SET ADDRESS = 'Pune'
WHERE ID = 6;
OUTPUT:

ID | NAME | AGE | ADDRESS | SALARY |


| 1 | Luffy | 32 | GGN | 2000.00 |
| 2 | Sanji | 25 | Delhi | 1500.00 |
| 3 | Zoro | 23 | Kota | 2000.00 |
| 4 | Nami | 25 | Mumbai | 6500.00 |
| 5 | Hardik | 27 | Bhopal | 8500.00 |
| 6 | Komal | 22 | Pune | 4500.00 |
| 7 | Brook | 24 | FBD | 10000.00

28
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
4 LIKE COMAND

Syntax
The basic syntax of % and _ is as follows −
SELECT FROM table_name
WHERE column LIKE 'XXXX%'

or

SELECT FROM table_name


WHERE column LIKE '%XXXX%'

or

SELECT FROM table_name


WHERE column LIKE 'XXXX_'

or

SELECT FROM table_name


WHERE column LIKE '_XXXX'

or

SELECT FROM table_name


WHERE column LIKE '_XXXX_'

Sr.No. Statement & Description

1 WHERE SALARY LIKE '200%'


Finds any values that start with 200.

WHERE SALARY LIKE '%200%'


2
Finds any values that have 200 in any position.

WHERE SALARY LIKE '_00%'


3
Finds any values that have 00 in the second and third positions.

29
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
WHERE SALARY LIKE '2_%_%'
4
Finds any values that start with 2 and are at least 3 characters in length.

WHERE SALARY LIKE '%2'


5
Finds any values that end with 2.

WHERE SALARY LIKE '_2%3'


6
Finds any values that have a 2 in the second position and end with a 3.

WHERE SALARY LIKE '2___3'


7
Finds any values in a five-digit number that start with 2 and end with 3.

EXAMPLE:
Consider the CUSTOMERS table having the following records −

ID | NAME | AGE | ADDRESS | SALARY |


| 1 | Luffy | 32 | GGN | 2000.00 |
| 2 | Sanji | 25 | Delhi | 1500.00 |
| 3 | Zoro | 23 | Kota | 2000.00 |
| 4 | Nami | 25 | Mumbai | 6500.00 |
| 5 | Hardik | 27 | Bhopal | 8500.00 |
| 6 | Komal | 22 | MP | 4500.00 |
| 7 | Brook | 24 | FBD | 10000.00 |
EXAMPLE:
It will display all the records from the CUSTOMERS table, where the SALARY starts with
200.

SELECT * FROM CUSTOMERS


WHERE SALARY LIKE '200%';

OUTPUT:

30
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720
ID | NAME | AGE | ADDRESS | SALARY |
| 1 | Luffy | 32 | GGN | 2000.00 |
| 3 | Zoro | 23 | Kota | 2000.00

31
Aniket Kushwaha
4th Sem Section D Enrollment no. 00650601720

You might also like