Information System Management Lab File

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 32

INFORMATION SYSTEM MANAGEMENT LAB FILE

BBA 212
SUBMITTED BY: SUBMITTED TO:

Student Name: Bhavya udinia Ms. Supreet kaur

Roll No: 01690201819

Semester: 6th BBA (B&I)

SRI GURU TEGH BAHADUR INSTITUTE OF MANAGEMENT &


INFORMATION TECHNOLOGY

(Affiliated to Guru Gobind Singh Indraprastha University Delhi)

1
CONTENTS

S.NO. TOPIC PAGE NO.

1. PRACTICAL 1 3-7

2. PRACTICAL 2 8

3. PRACTICAL 3 9-13

4. PRACTICAL 4 14-18

5. PRACTICAL 5 19-23

6. PRACTICAL 6 24-28

7. PRACTICAL 7 29-33

2
PRACTICAL 1
Q1. Write short note on SQL and Oracle Database SQL.

SQL

Structured Query Language (SQL) is a standard computer language for relation


database management and data manipulation. SQL is used to query, insert,
update and modify data. Most relation database supports SQL, which is an
added benefit for database administrators (DBAs), as they are often required to
support databases across several different platforms.

Also they are using different dialects, such as-

 MS SQL Server using T-SQL


 Oracle using PL/SQL
 MS Access version of SQL is called JET SQL (native format) etc.

Why SQL?

SQL is widely popular because it offers the following advantages-

 Allows user to access data in the relational database management


systems.
 Allows user to describe the data.
 Allows user to define the data in a database and manipulate that data.
 Allows to embed within other language using SQL modules, libraries &
pre-compilers.
 Allows users to create and drop databases and tables.
 Allows users to create view, stored procedure, functions in a database.
 Allows users to set permission on tables, procedures and views.

3
A brief history of SQL:

 1970- Dr. Edgar F. “Ted” Codd of IBM is known as the father of


relational databases. He described a relational model of database.
 1974- Structured Query Language prepared.
 1978- IBM worked to develop Codd’s ideas and released a product
named System/R.
 1986- IBM developed the first prototype of relational database and
standardized by ANSI. The first relational database was releases by
Relational Software which later came to known as Oracle.

SQL Process:

When you are executing an SQL command for any RDBMS, the system
determines the best way to carry out your request and SQL engine figures out
how to interpret the task.

There are various components included in this process:

These components are-

 Query Dispatcher
 Optimization Engines
 Classic Query Engine
 SQL Query Engine etc.

A classic query engine handles all the non-SQL queries, but a SQL query
engine won’t handle logical files.

Following is a simple diagram showing the SQL Architecture-

4
SQL Commands

The standard SQL commands to interact with relational databases are CREATE,
SELECT, INSERT, UPDATE, DELETE and DROP. These commands can be
classified into the following groups based on their nature-

DDL-Data Definition Language:

Sr. No. Command and Description


1 CREATE
Creates a new table, a view of a table, or other object in the
database.
2 ALTER
Modifying an existing database object, such as a table.
3 DROP
Deletes an entire table, a view of a table or other objects in
the database.

5
DML-Data Manipulation Language:

Sr. No. Command and Description


1 SELECT
Retrieves certain records from one or more tables.
2 INSERT
Creates a record
3 UPDATE
Modifies records
4 DELETE
Delete records

ORACLE DATABASE

 Oracle database (Oracle DB) is a relational database management


(RDBMS) from the ORACLE Corporation, Originally developed in 1977
by Lawrence Ellison and other developers, Oracle DB is one of the most
trusted and widely-used relational database engines.
 The system is built around a relational database framework in which data
objects may be directly accessed by users (or an application front end)
through structured query language (SQL)
 Oracle is a fully scalable relational database architecture and is often used
by a global enterprises, which manage and process data across wide and
local area networks. The oracle database has its own network component
to allow communications across networks.

Oracle DB runs out on most major platforms, including Windows, UNIX, Linux
and Mac OS. Different software versions are available, based on requirements
and budget. Oracle DB editions are hierarchically broken down as follows:

6
 Enterprises Edition: Offers all features, including superior performances
and security, and is the most robust.
 Standard Edition: Contains base functionally for users that do not require
Enterprise Edition’s robust package.
 Oracle Lite: For mobile devices.

7
PRACTICAL 2

Q2. Draw an ER diagram for the following database:

a) Employee: Ename, Ecity, Esalary, Enumber, Eaddress, Edepartment.

b) Company: Cname, Ccity, Cnumber, Enumber.

Eaddres
s

n 1
Employee Work Company
s

Enumber

8
PRACTICAL 3
Q3. Write a program to study basic SQL commands (create table, insert, select
and execute the following queries using SQL commands:-

a) Create a database employ in that create table EMP with attributes Ename,
Ecity, Esalary, Enumbers, Eaddress and Department name.
b) Create another table company with attributes Cname, Ccity, Cnumber,
Enumber in database employ.

 PRACTICAL COMMAND
a) EMPLOYEE TABLE

CREATE TABLE Employee

(Ename varchar(10) not null, Ecity varchar(10), Esalary number(10) not null,
Eaddress varchar(15), DepartmentName varchar(10), Enumber number(12)
primary key);

DESC Employee

INSERT INTO EMPLOYEE VALUES ('BHARAT','MANESAR',750200,'H-56


kamlan','IT',9845632475)

INSERT INTO EMPLOYEE VALUES ('KARTIK','DELHI',85000,'H-78


gevra','HR',9874527596)

INSERT INTO EMPLOYEE VALUES ('KAPIL','ROHTAK',65000,'H-98


Mundka','marketing',9874563214)

INSERT INTO EMPLOYEE VALUES ('GAURAV','GURUGRAM',96000,'H-


52 nangloi','FINANCE',8547689512)

9
INSERT INTO EMPLOYEE VALUES ('ISHAN','SONIPAT',85000,'H-65
devcolony','marketing',9645787456)

INSERT INTO EMPLOYEE VALUES ('HARPREET','DELHI',63000,'H-98


moti nagar','operations',9312279451)

INSERT INTO EMPLOYEE VALUES ('ROHAN','KANPUR',98000,'H-68


sector1','TECHNICAL',9856472319)

INSERT INTO EMPLOYEE VALUES ('NIKHIL','MATHURA',60999,'HN-


896 sector5','HR',9564836215)

INSERT INTO EMPLOYEE VALUES ('DEEPANK','PALWAL',80000,'HN-


124 sector6','FINANCE',9265447512)

INSERT INTO EMPLOYEE VALUES ('ARJUN','JHAJJAR',50000,'HN


sector2','marketing',9654123875)

INSERT INTO EMPLOYEE VALUES ('DHRUV','MUMBAI',35000,'HN-98


sector1','IT',9526134789)

SELECT * FROM EMPLOYEE

b) COMPANY TABLE

create table COMPANY (Cname varchar(10) not null, Ccity varchar(10),


Cnumber number(10) not null, Enumber number(12) primary key));

desc COMPANY;

insert into COMPANY values('L V','California',9874,2345);

insert into COMPANY values('IBM','Hyderabad',5896,75864);

insert into COMPANY values('ITC','Delhi',8964,86545);

insert into COMPANY values('Wipro','Mumbai',8965,32145);

insert into COMPANY values('Tata','Pune',6574,89454);

10
insert into COMPANY values('Sharekhan','Delhi',5462,89561);

insert into COMPANY values('Avinity','Gurugram',9652,85462);

insert into COMPANY values('Sharekhan','Kanpur',8562,98756);

insert into COMPANY values('Infosys','Mumbai',8563,99945);

insert into COMPANY values('DLF','Gurgaon',5641,98563);

select * from COMPANY

OUTPUT

a)

b)

11
c)

d)

12
PRACTICAL 4
Q4. To study viewing command (select, where, update) and execute the
following queries using these commands:

a. Find the name of all employees who live in ‘Delhi’.


b. Find the company of employees is greater than Eight thousand.
c. Change the name of all employees who live in Kanpur to ‘Ename’.
d. Increase the ‘Enumber’ of all the companies whose names are ‘Company
Name by 2000.

 PRACTICAL COMMAND

CREATE TABLE Employee (Ename varchar(10) not null, Ecity varchar(10),


Esalary number(10) not null, Eaddress varchar(15), DepartmentName
varchar(10), Enumber number(12) primary key);

desc EMPLOYEE;

DESC Employee

INSERT INTO EMPLOYEE VALUES ('BHARAT','MANESAR',750200,'H-56


kamlan','IT',9845632475)

INSERT INTO EMPLOYEE VALUES ('KARTIK','DELHI',85000,'H-78


gevra','HR',9874527596)

INSERT INTO EMPLOYEE VALUES ('KAPIL','ROHTAK',65000,'H-98


Mundka','marketing',9874563214)

13
INSERT INTO EMPLOYEE VALUES ('GAURAV','GURUGRAM',96000,'H-
52 nangloi','FINANCE',8547689512)

INSERT INTO EMPLOYEE VALUES ('ISHAN','SONIPAT',85000,'H-65


devcolony','marketing',9645787456)

INSERT INTO EMPLOYEE VALUES ('HARPREET','DELHI',63000,'H-98


moti nagar','operations',9312279451)

INSERT INTO EMPLOYEE VALUES ('ROHAN','KANPUR',98000,'H-68


sector1','TECHNICAL',9856472319)

INSERT INTO EMPLOYEE VALUES ('NIKHIL','MATHURA',60999,'HN-


896 sector5','HR',9564836215)

INSERT INTO EMPLOYEE VALUES ('DEEPANK','PALWAL',80000,'HN-


124 sector6','FINANCE',9265447512)

INSERT INTO EMPLOYEE VALUES ('ARJUN','JHAJJAR',50000,'HN


sector2','marketing',9654123875)

INSERT INTO EMPLOYEE VALUES ('DHRUV','MUMBAI',35000,'HN-98


sector1','IT',9526134789)

SELECT * FROM EMPLOYEE

SELECT * FROM EMPLOYEE where Ecity='Delhi'

update EMPLOYEE set Ename= ‘Ashish’ where Ecity= ‘Kanpur’

COMPANY TABLE

create table COMPANY (Cname varchar(10) not null, Ccity varchar(10),


Cnumber number(10) not null, Enumber number(12) primary key));

desc COMPANY

14
insert into COMPANY values('L V','California',9874,2345);

insert into COMPANY values('IBM','Hyderabad',5896,75864);

insert into COMPANY values('ITC','Delhi',8964,86545);

insert into COMPANY values('Wipro','Mumbai',8965,32145);

insert into COMPANY values('Tata','Pune',6574,89454);

insert into COMPANY values('Sharekhan','Delhi',5462,89561);

insert into COMPANY values('Avinity','Gurugram',9652,85462);

insert into COMPANY values('Sharekhan','Kanpur',8562,98756);

insert into COMPANY values('Infosys','Mumbai',8563,99945);

insert into COMPANY values('DLF','Gurgaon',5641,98563);

select * from COMPANY

select Cname from COMPANY where Enumber>'8000'

update COMPANY set Enumber=85462+2000 where Cname='Avinity'

OUTPUT

a.

15
b.

c.

16
d.

17
PRACTICAL 5
Q5. Write a program to study alter SQL command and execute the following
queries:

a) Add a new column in employee table and name it as Eproject.


b) Add a new column in company table and name it as Cspecialisation.
c) Modify any column in employee table to make it as not null.
d) Drop any column from the company table.

 PRACTICAL COMMAND

CREATE TABLE Employee (Ename varchar(10) not null, Ecity varchar(10),


Esalary number(10) not null, Eaddress varchar(15), DepartmentName
varchar(10), Enumber number(12) primary key);

DESC Employee

INSERT INTO EMPLOYEE VALUES ('BHARAT','MANESAR',750200,'H-56


kamlan','IT',9845632475)

INSERT INTO EMPLOYEE VALUES ('KARTIK','DELHI',85000,'H-78


gevra','HR',9874527596)

INSERT INTO EMPLOYEE VALUES ('KAPIL','ROHTAK',65000,'H-98


Mundka','marketing',9874563214)

INSERT INTO EMPLOYEE VALUES ('GAURAV','GURUGRAM',96000,'H-


52 nangloi','FINANCE',8547689512)

INSERT INTO EMPLOYEE VALUES ('ISHAN','SONIPAT',85000,'H-65


devcolony','marketing',9645787456)

18
INSERT INTO EMPLOYEE VALUES ('HARPREET','DELHI',63000,'H-98
moti nagar','operations',9312279451)

INSERT INTO EMPLOYEE VALUES ('ROHAN','KANPUR',98000,'H-68


sector1','TECHNICAL',9856472319)

INSERT INTO EMPLOYEE VALUES ('NIKHIL','MATHURA',60999,'HN-


896 sector5','HR',9564836215)

INSERT INTO EMPLOYEE VALUES ('DEEPANK','PALWAL',80000,'HN-


124 sector6','FINANCE',9265447512)

INSERT INTO EMPLOYEE VALUES ('ARJUN','JHAJJAR',50000,'HN


sector2','marketing',9654123875)

INSERT INTO EMPLOYEE VALUES ('DHRUV','MUMBAI',35000,'HN-98


sector1','IT',9526134789)

SELECT * FROM EMPLOYEE

ALTER table EMPLOYEE add(Eproject varchar(15));

ALTER table EMPLOYEE modify(Eaddress varchar(15) not null);

COMPANY TABLE

create table COMPANY (Cname varchar(10) not null, Ccity varchar(10),


Cnumber number(10) not null, Enumber number(12) primary key));

desc COMPANY

insert into COMPANY values('L V','California',9874,2345);

insert into COMPANY values('IBM','Hyderabad',5896,75864);

insert into COMPANY values('ITC','Delhi',8964,86545);

19
insert into COMPANY values('Wipro','Mumbai',8965,32145);

insert into COMPANY values('Tata','Pune',6574,89454);

insert into COMPANY values('Sharekhan','Delhi',5462,89561);

insert into COMPANY values('Avinity','Gurugram',9652,85462);

insert into COMPANY values('Sharekhan','Kanpur',8562,98756);

insert into COMPANY values('Infosys','Mumbai',8563,99945);

insert into COMPANY values('DLF','Gurgaon',5641,98563);

select * from COMPANY

ALTER table COMPANY add(Cspecialisation varchar(15));

ALTER table COMPANY DROP COLUMN enumber;

OUTPUT

a.

20
b.

c.

21
d.

22
PRACTICAL 6
Q6. To study the command that involve compound conditions between like and
execute the full queries using these commands:

a) Find the Name of all Employees who live in Delhi and whose salary is
between 80000 to 90000.
b) Find the Names of all the Employees whose Name either begin with ‘D’
OR ‘K’.
c) Find the Company Name where the Company City is Delhi and Number
of Employees is not between 80000 and 85000.
d) Find Name of all the Companies that do not end with ‘n’.

 PRACTICAL COMMAND

CREATE TABLE Employee (Ename varchar(10) not null, Ecity varchar(10),


Esalary number(10) not null, Eaddress varchar(15), DepartmentName
varchar(10), Enumber number(12) primary key);

DESC Employee

INSERT INTO EMPLOYEE VALUES ('BHARAT','MANESAR',750200,'H-56


kamlan','IT',9845632475)

INSERT INTO EMPLOYEE VALUES ('KARTIK','DELHI',85000,'H-78


gevra','HR',9874527596)

INSERT INTO EMPLOYEE VALUES ('KAPIL','ROHTAK',65000,'H-98


Mundka','marketing',9874563214)

INSERT INTO EMPLOYEE VALUES ('GAURAV','GURUGRAM',96000,'H-


52 nangloi','FINANCE',8547689512)

23
INSERT INTO EMPLOYEE VALUES ('ISHAN','SONIPAT',85000,'H-65
devcolony','marketing',9645787456)

INSERT INTO EMPLOYEE VALUES ('HARPREET','DELHI',63000,'H-98


moti nagar','operations',9312279451)

INSERT INTO EMPLOYEE VALUES ('ROHAN','KANPUR',98000,'H-68


sector1','TECHNICAL',9856472319)

INSERT INTO EMPLOYEE VALUES ('NIKHIL','MATHURA',60999,'HN-


896 sector5','HR',9564836215)

INSERT INTO EMPLOYEE VALUES ('DEEPANK','PALWAL',80000,'HN-


124 sector6','FINANCE',9265447512)

INSERT INTO EMPLOYEE VALUES ('ARJUN','JHAJJAR',50000,'HN


sector2','marketing',9654123875)

INSERT INTO EMPLOYEE VALUES ('DHRUV','MUMBAI',35000,'HN-98


sector1','IT',9526134789)

SELECT * FROM EMPLOYEE

Select Ename from EMPLOYEE where Ecity='Delhi' and Esalary


between 80000 and 90000;

Select Ename from EMPLOYEE where Ename like ‘D%’ or Ename


like ‘K%’;

COMPANY TABLE

create table COMPANY (Cname varchar(10) not null, Ccity varchar(10),


Cnumber number(10) not null, Enumber number(12) primary key));

desc COMPANY

24
insert into COMPANY values('L V','California',9874,2345);

insert into COMPANY values('IBM','Hyderabad',5896,75864);

insert into COMPANY values('ITC','Delhi',8964,86545);

insert into COMPANY values('Wipro','Mumbai',8965,32145);

insert into COMPANY values('Tata','Pune',6574,89454);

insert into COMPANY values('Sharekhan','Delhi',5462,89561);

insert into COMPANY values('Avinity','Gurugram',9652,85462);

insert into COMPANY values('Sharekhan','Kanpur',8562,98756);

insert into COMPANY values('Infosys','Mumbai',8563,99945);

insert into COMPANY values('DLF','Gurgaon',5641,98563);

select * from COMPANY

select Cname from COMPANY where Ccity='Delhi' and Enumber not


between 80000 and 85000;

select Cname from COMPANY where Cname is not like ‘%n’

25
OUTPUT
a)

b)

26
c)

d)

27
PRACTICAL 7
Q7. To study aggregate functions (sum, max, avg.) and execute the following
queries using these commands: -

a) Find sum and average of the salary of all the employees of all
Department.
b) Find the number of employees who lives in New Delhi.
c) Find maximum and minimum salary of all the department.

 PRACTICAL COMMAND

CREATE TABLE Employee (Ename varchar(10) not null, Ecity varchar(10),


Esalary number(10) not null, Eaddress varchar(15), DepartmentName
varchar(10), Enumber number(12) primary key);

DESC Employee

INSERT INTO EMPLOYEE VALUES ('BHARAT','MANESAR',750200,'H-56


kamlan','IT',9845632475)

INSERT INTO EMPLOYEE VALUES ('KARTIK','DELHI',85000,'H-78


gevra','HR',9874527596)

INSERT INTO EMPLOYEE VALUES ('KAPIL','ROHTAK',65000,'H-98


Mundka','marketing',9874563214)

INSERT INTO EMPLOYEE VALUES ('GAURAV','GURUGRAM',96000,'H-


52 nangloi','FINANCE',8547689512)

INSERT INTO EMPLOYEE VALUES ('ISHAN','SONIPAT',85000,'H-65


devcolony','marketing',9645787456)

28
INSERT INTO EMPLOYEE VALUES ('HARPREET','DELHI',63000,'H-98
moti nagar','operations',9312279451)

INSERT INTO EMPLOYEE VALUES ('ROHAN','KANPUR',98000,'H-68


sector1','TECHNICAL',9856472319)

INSERT INTO EMPLOYEE VALUES ('NIKHIL','MATHURA',60999,'HN-


896 sector5','HR',9564836215)

INSERT INTO EMPLOYEE VALUES ('DEEPANK','PALWAL',80000,'HN-


124 sector6','FINANCE',9265447512)

INSERT INTO EMPLOYEE VALUES ('ARJUN','JHAJJAR',50000,'HN


sector2','marketing',9654123875)

INSERT INTO EMPLOYEE VALUES ('DHRUV','MUMBAI',35000,'HN-98


sector1','IT',9526134789)

SELECT * FROM EMPLOYEE

a) Select sum (Esalary) from EMPTABLE0 where DepartmentName=’Finance’;


Select avg (Esalary) from EMPLOYEE where DepartmentName='Finance';
b) Select count (Ename) from EMPLOYEE where Ecity='Delhi';
c) select max (Esalary) from EMPLOYEE;
select min (Esalary) from EMPLOYEE;

29
OUTPUT

a)

30
b)

c)

31
32

You might also like