You are on page 1of 32

Practical file on

INFORMATION SYSTEMS MANAGEMENT - LAB


(BBA 307)

Submitted To : Submitted By :
Ms. Preeti Talwar Name: - Sahil Khanna
Assoc. Professor, RDIAS Class: - BBA-V
Roll No:--01715901721

RUKMINI DEVI INSTITUTE OF ADVANCED STUDIES

An ISO 9001:2015 Certified Institute

NAAC Accredited: A Grade (3rd Cycle), Category A+ Institution (by SFRC, Govt of NCT of Delhi)

(Approved by AICTE, HRD Ministry, Govt. of India)

Affiliated to Guru Gobind Singh Indraprastha University, Delhi

2A & 2B, Madhuban Chowk, Outer Ring Road, Phase-1, Delhi-110085


TABLE OF CONTENTS

S.NO Annexure Date Of Submission

1 Annexure 1 25-09-2023

2 Annexure 2 10-10-2023

3 Annexure 3 19-11-2023
CERTIFICATE FROM FACULTY GUIDE

This is to certify that the Information System Management – Lab File is an academic work done
by Sahil Khanna submitted in partial fulfillment of the requirement for the award of degree of
“Bachelors in Business Administration” from “Rukmini Devi Institute of Advanced Studies”
under my guidance and direction.

To the best of my knowledge and belief, the data and information presented by her in the lab file
were not previously submitted elsewhere.

Name Of Faculty: Ms. Preeti Tanwar


Designation Of Faculty: Associate Professor, RDIAS
Annexure I

Ques.1- Demonstrate the understanding of facts by:


A. Making a pictorial presentation of a table and its different components
B. Make a cheat sheet of all the Basic DDL commands
Solution 1. -
A. Pictorial Presentation of a Table & its different Components
A table in a database usually consist of the following components:

1. Table Name: The name that uniquely identifies the table within the database
2. Columns :
 Vertical components representing different data attribute
 Each column has a name and a data type associated with it
3. Rows:
 Horizontal components representing individual records
 Each row contains values corresponding to the attributes defined by the column

B. Basic DDL Command Cheat Sheet :


Data Definition Language (DDL) commands are used to define and manage the structure of database
objects.

1. Create Table - table name ( column_1


datatype, column_2 datatype,column_3
data type);

2. Alter Table – alter table table_name


Add column_name datatype [constraint];

3. Drop Table – table_name;

4. Create Index - index_name


table_name (column1, column2, ...);

5. Rename Table – old_table_name RENAME TO new_table_name;


6. Comment on Column - table_name. Column_name IS 'comment here';

Ques.2 - Create a table Student using the following Schema

Solution.2-

Ques.3- Design an Entity Relationship (ER) model for a college database in MS word. Say
we have the following statements.
a. A college contains many departments
b. Each department can offer any number of courses
c. Many instructors can work in a department
d. An instructor can work only in one department
e. For each department there is a Head
f. An instructor can be head of only one department
g. Each instructor can take any number of courses
h. A course can be taken by only one instructor
i. A student can enroll for any number of courses
j. Each course can have any number of students

Solution.3-
Ques.4- Identify any 5 tables from above case study , create them and add at least 5 rows in
each.
Solution.4-

1. College

2. Department
3. Instructor

4. Course

5. Student
Ques.5- Perform following SQL DDL commands using any tables you created in question 3
A. Rename
B. Drop
C. Delete
D. Truncate
E. Alter
Solution.5-

1. Rename

2. Drop

3. Delete
4. Truncate

5. Alter
Annexure 2

Question 1:
A
Syntax:
create table faculty1528
(T_ID integer primary key,
Name varchar(25) not null,
dept varchar(5),
age integer check (age>=18),
place varchar(30) default 'Delhi',
contact integer UNIQUE);

Input:

Output:

B.
Syntax:
create table salesman_vivid
(salesman_id integer PRIMARY KEY,
name varchar(30),
city char(25),
commission varchar(20));
Input:

C
Syntax:
Create table salesman_vivid
(salesman_id integer,
Name varchar(30),
City char(25),
Commission varchar(20));
Desc salesman_vivd;

Input:

D
Syntax:
Select*from salesman_vivid;
Input:

E
Syntax:
select*from salesman_vivid order by salesman_id;

Input:

F.
Syntax:
select* from salesman_vivid where city IN ('Paris','Rome');
Input:
G.
Syntax:
select* from salesman_vivid where salesman_id between 5002 and 5006;

Input:

H.
Syntax:
select* from salesman_vivid where name like('P%M');
Input:
Output after performing all the parts:

Question2:
A
Syntax:
CREATE TABLE faculty (
t_id INT PRIMARY KEY,
name VARCHAR(25) NOT NULL,
dept VARCHAR(5),
age INT CHECK (age >= 18),
place VARCHAR(30) DEFAULT 'delhi',
contact INT UNIQUE
Input:
B
Syntax:
Alter table faculty1411
Add salary varchaar(5);

Input:

Output:
Syntax:
Alter table faculty1411
Add attendance integer;

Input:

Output:

C
Syntax:
Alter table faculty1411
Modify salary interger;

Input:

Output:

D
Syntax:
Alter table faculty 1411
Drop column attendance;

Input:
Output:

Question 3:
Syntax:

create table hospital_1411


(no integer,
name varchar(20),
age integer,
department varchar(25),
dateofadm varchar(30),
charges integer,
sex vaarchaar(5));

insert into hospital_1411(no,name,age,department,dateofadm,charges,sex)


values('1','sandeep','65','surgery','23-feb-1998','300','m');
insert into hospital_1411(no,name,age,department,dateofadm,charges,sex)
values('2','ravina','24','orthopedic','20-jan-1998','200','f');
insert into hospital_1411(no,name,age,department,dateofadm,charges,sex)
values('3','kARAN','45','orthopedic','19-feb-1998','300','m');
insert into hospital_1411(no,name,age,department,dateofadm,charges,sex)
values('4','tarun','12','surgery','01-jan-1998','300','m');
insert into hospital_1411(no,name,age,department,dateofadm,charges,sex)
values('5','zubin','36','ENT','12-feb-1998','250','m');
insert into hospital_1411(no,name,age,department,dateofadm,charges,sex)
values('6','ketaki','16','ENT','24-feb-1998','300','f');

Input:

A
Syntax:
select*from hospital_1411 ORDER BY name ASC;
Input:
Output:

B
Syntax:
select name,charges,age from hospital_1411 WHERE sex like 'm';

Input:

Output:
C
Syntax:
select*from hospital_1411 WHERE department='cardiology';
Input:

Output:

D
Syntax:
update hospital_1411 set charges=300 WHERE name='ravina';

Input:

Output:

E
Syntax:
select*from hospital_1411 WHERE age>25 and department='ENT';
Input:
Output:

F
Syntax:
select sum(charges) from hospital_1411 WHERE dateofadm<'1998-feb-12';
Input:

Output:
Question 4:
B
Syntax:
Select count (distinct department) as distinct_department_count from hospital;
Input:

Output:

D
Syntax:
Select AVG(charges) AS average_charges FROM hospital;
Input:
Output:
Annexure 3

S.No LIST OF
QUESTIONS
1. Querying Multiple Tables

TABLE: STAFF_DETAILS
DEPT_ID SALARY BENEFITS CITY
301 15000 2000 Delhi
302 25000 3100 Mumbai
205 25000 2500 Bangalore
406 35000 3500 Delhi
405 12000 2100 Pune
407 40000 3000 Pune
TABLE: STAFF
S_ID NAME AGE POSITION DATEOFJOIN DEPT_ID
1006 Sarah 32 Advisor 11-Feb-1991 205
1007 Manisha 45 Clerk 22-Jun-1979 406
1004 Raghav 42 Manager 01-May-1982 405
1008 George 37 Manager 2-Dec-1984 302
1009 Senzela 29 Clerk 13-june-1993 407
1005 Sam 49 Manager 12-Dec-1972 301

1. Construct the table staff using at least three constraints in it.


2. Insert values in the table staff same as provided.
3. Create table staff_details which references table staff by using appropriate constraint.
4. Insert values in the table staff_details same as provided.

2. Identify the foreign key and Primary key from the tables given in Q1 with justification.
3.
Based on the tables given in the Q1, solve the queries.

i. Count the number of positions available.


ii. Write a query to get the difference between the highest and lowest salaries.
iii. Find the total of salary and benefits and name it as totalsalary.
iv. Display only Dept_id, salary and benefits of the highest benefit given from the table
staff_details.
v. Display name, age and position of the staff members having age greater than the
average age of all staff members in descending order of names.
vi. Find minimum and maximum age of Managers.

4.
Based on the tables given in the Q1, solve the queries.

i. Display all the columns present in both tables.


ii. Display Name, position and salary of all staffs.
iii. List Name, age, city and salary of all Managers.
iv. Display S_id, Name, benefits and salary of all staffs having salary more than 20000.
v. Display S_id, Name, benefits , position of staff people where position have ‘e’ present in
it.
Solutions

Answer 1.
1. Construct the table staff using at least three constraints in it.

2. Insert values in the table staff same as provided.

3. Create table staff_details which references table staff by using appropriate constraint.
4. Insert values in the table staff_details same as provided.

Answer 2.
In the given tables, the primary key and foreign key relationships are as follows:
1. STAFF
1. Primary Key:
 Column: S_ID
 Justification: The S_ID column is designated as the primary key, which means it uniquely identifies
each record in the STAFF table.
2. Foreign Key:
 Column: DEPT_ID
 Justification: The DEPT_ID column in the STAFF table is a foreign key that references the primary
key DEPT_ID in the STAFF_DETAILS table. This establishes a link between the two tables,
indicating the department to which each staff member belongs.
2. STAFF_DETAILS
 Primary Key:
 Column: DEPT_ID
 Justification: The DEPT_ID column is designated as the primary key, which means it uniquely
identifies each record in the STAFF_DETAILS table.
 Foreign Key:
 Column: DEPT_ID
 Justification: While DEPT_ID is the primary key for the STAFF_DETAILS table, it is also used as
a foreign key in the STAFF table. This establishes a link between the two tables, ensuring that the
department information is consistent between them.

Summary
The primary key uniquely identifies records within a table, and the foreign key establishes a link between
tables by referencing the primary key of another table, thus creating a relationship between them. In this
case, the DEPT_ID column serves as both the primary key in the STAFF_DETAILS table and a foreign key
in the STAFF table, creating a connection between these two tables based on department information.
Answer 3.

1. Count the number of positions available

2. Write a query to get the difference between the highest and lowest salaries

3. Find the total of salary and benefits and name it as total salary

4. Display only Dept_id, salary and benefits of the highest benefit given from the table staff_details .

5. Display name, age and position of the staff members having age greater than the average age of all staff
members in descending orders of names.
6. Find minimum and maximum age of managers.

Answer 4.

1. Display all the columns present in both the tables

2. Display name positions and salary of all staffs.

3. List name, age, city and salary of all managers.

4. Display S_id, name, benefits and salary of all staff having salary more than 20000.
5. Display S_id, name, benefits, position of staff people where position have ‘e’ present in it.

You might also like