0% found this document useful (0 votes)
60 views

ISM LAB FILE by Raman

This document contains a student's practical lab file submitted for their Information System Management course. It includes 17 sections that explain various SQL commands like DDL, DML, constraints, aggregate functions and operators through examples and syntax. It also includes ER diagrams for different domains like banking, organization, university and hospital management systems.

Uploaded by

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

ISM LAB FILE by Raman

This document contains a student's practical lab file submitted for their Information System Management course. It includes 17 sections that explain various SQL commands like DDL, DML, constraints, aggregate functions and operators through examples and syntax. It also includes ER diagrams for different domains like banking, organization, university and hospital management systems.

Uploaded by

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

GURU GOBIND SINGH INDRAPRASTH UNIVERSITY

NEW DELHI

Practical Lab File


On
Information System Management Lab
(BBA-212)
Submitted in partial fulfillment of requirement for the
award of degree of BBA
Session: 2020-2023

SUBMITTED AT:
Delhi Metropolitan Education

[AFFILIATED TO GGSIPU-NEW DELHI]

Submitted by: Submitted to:


Ramandeep Singh Ms. Pooja tripathi
BBA SEC (C) (Assistant Professor)
07912501720

1|Page
CERTIFICATE

This is to certify that 03591201720 (enrollment no.) have


successfully completed the Information System Management Lab
work. Ramandeep Singh submitted in partial fulfillment of the
requirement for the award of degree of Bachelor of Business
Administration at Delhi School of Professional Studies and
Research, New Delhi under my guidance and direction.

Ramandeep Singh has given undertaking that the information


presented in the project has not been submitted earlier.

(Signature of Faculty)
Ms. Pooja tripathi
Assistant Professor

2|Page
DECLARATION
I take this opportunity to express my profound gratitude and deep
regrets to my guidance Asst. Professor Ms. Pooja Tripathi for her
exemplary guidance, monitoring and constant encouragement
throughout the course of this project. The blessing, help and guidance
by her time to time shall carry me a long way in the journey of life on
which I am about to embark.

Last but not the least, my sincere thanks to my parents and friends for
the wholehearted support and encouragement.

I also declare that the project work entitled “Information System


Management Lab” under the guidance of Ms. Anshika Negi my original
work and it has not been submitted earlier in any other university or
institution.

Ramandeep Singh

Delhi School of Professional Studies and Research, semester – 4b

03591201720

3|Page
INDEX
S.NO CONTENTS PG. NO T. SIGN
1 Introduction to SQL and types of datatypes 5
2 SQL DDL Commands with syntax & examples 5-8
3 SQL DML Commands with syntax & examples 8-9
4 Primary key and Foreign key constraints 9-12
5 Update command & Alter command 12-13
Command for ‘Order By’ & ‘Like’ clause 13-14
Command for Aggregate Functions 14-15
Command for operators – less than, greater 15-18
than, less than equal to, greater than equal
to, between, like, IN
6 Command for operators – and, or, not 18-19
7 Command for indexes and views 19-20
8 Command for Upper case, Lower case, 20-22
Substring, Replace
9 Command for concat, length, MONTH 22-23
DAYOFMONTH and YEAR
10 Create Employee table and run given 23-25
commands
11 Create Student table and run given 25-27
commands
12 Create Supplier table and Parts table and run 27-29
given commands
13 What do you understand by ER Modeling 30-32
14 Symbols of ER Model with examples 33
15 ER Diagram of an Organization 33
16 ER Diagram of a Banking System 34
17 ER Diagram of a Hospital Management 34
System
18 ER Diagram of a University 35

4|Page
ISM LAB FILE
1. Introduction to SQL. Explain different types of data types in
SQL.
 Structured Query Language is a scripting language to access
databases.
 It allows you to create or delete databases, fetch or modify
rows, etc.
 It allows you to manipulate or retrieve data stored in a
database like MySQL, MS Access, Oracle, etc.
 Some of its data types are following –
 Numeric data type – it contains exact numeric digits
like integers, decimals, etc. as well as approximate
numeric digits like float, real, double precision, etc.
 Date and Time data type – it contains values related to
date, time, timestamps, year, etc.
 String data type – it contains text and binary data like
files, images, etc.
 Binary Large Object data type – it can hold a variable
amount of data.
 Spatial data type – it contains geometrical and
geographical values.
2. Explain SQL DDL commands with syntax and examples.
 Data Definition Language (DDL) is a subcategory of SQL
which is used to define and work with database structure.
 This include name of each table and database and their
connection. Some commands are –
 CREATE – it is used to create new databases, tables, and
columns within tables.
5|Page
 Syntax – create database name;
 Example – create database sahil_kaku;
 Syntax – create table name ( column1 data_type,
column2 data_type, ….);
 Example – create table section_b (enroll int, name
varchar(20), age int);
 SHOW – it is used to display a list of databases and tables in
a system.
 Syntax – show databases;
 Syntax – show tables;
 USE – it is used to access databases to create tables in in
them.
 Syntax – use database name;
 Example – use sahil_kaku;
 DESCRIBE – it is used to describe the content of a table.
 Syntax – desc table name;
 Example – desc section_b;
 ALTER – it is used make changes in a table like add/delete
columns, rename table, delete table, etc.
 Syntax (to add column) – alter table table_name add
column attribute_name data type;
 Example – alter table section_b add column branch
varchar(15);
 Syntax (to delete column) – alter table table_name
drop column attribute_name;
 Example – alter table section_b drop column branch;
 Syntax (to rename table) – alter table table_name
rename new_name;

6|Page
 Example – alter table section_b rename bba4;
 Syntax (to delete table) - drop table table_name;
 Example - drop table bba4;

7|Page
3. Explain SQL DML commands with syntax and examples.
 INSERT – it is used to insert new values in table.
 Syntax – insert into table_name ( value1, value2,…)
 Values (‘value1’, ‘value2’, ….);
 Example – insert into section_b (enroll, name, age)
 Values (‘101’, ‘sahil’, ‘20’);
 SELECT – it is used to select data from the table. Different
condition can be used with this command.
 Syntax – select * from table_name where clause;
 Example – select * from section_b;
 UPDATE – it is used to make changes in the values.
 Syntax – update table_name set attribute = value
where clause;
 Example – update section_b set name=’etisha’ where
enroll= ‘106’;
 DELETE – it is used to delete values from the table.
 Syntax – delete from table_name where clause;
8|Page
 Example – delete from section_b where name=
‘etisha’;

4. Write a command for Primary Key constraint and Foreign Key


constraint.
 Primary Key constraint specifies that the column’s value
must uniquely identify each row on which constraint has
been applied.
 Syntax – column_name datatype primary key
 Example – roll_no int primary key

9|Page
 Some conditions of primary key are –
 Insert records with distinctive values of roll no.

 Insert record where roll no. is same as any other and all
other values different
 Note – the query won’t be completed because primary key
(roll no.) contains duplicate value.

 Insert record where roll no. is different and all other values
same as any other.

10 | P a g e
 Foreign Key constraint is used to prevent actions that would
destroy link between tables
 Syntax – foreign key (column name from foreign table)
reference primary table name (primary key of primary table)
 Example – foreign key (player) reference bba4b (roll_no)
 Not Null constraint is used to ensure the given column of the
table never assign a null value.
 Syntax – column_name datatype not null
 Example – name varchar(20) not null

 Insert values in table games with player=5


 Note – it will show an error because value 5 in bba4b does not
exist

11 | P a g e
 Delete from table games where player=1
 Note – if we delete the record from table bba4b first, then it
will show an error ‘foreign key constraint fails’. To do so, first
we have to delete the record from foreign table.

 Delete from table bba4b where roll no=1

5. Write a command for Update command and Alter command.


 UPDATE – it is used to make changes in the values.
 Syntax – update table_name set attribute = value
where clause;
 Example – update bba4b set name=’shrish’ where
roll_no= ‘4’;
 ALTER – it is used make changes in a table like add/delete
columns, rename table, delete table, etc.
 Syntax (to add column) – alter table table_name add
column attribute_name data type;
 Example – alter table bba4b add column branch
varchar(15);
 Syntax (to delete column) – alter table table_name
drop column attribute_name;

12 | P a g e
 Example – alter table bba4b drop column branch;
 Syntax (to rename table) – alter table table_name
rename new_name;
 Example – alter table bba4b rename bba_4b;
 Syntax (to delete table) - drop table table_name;
 Example - drop table games;

Write command for ‘Order By’ and ‘Like’ clause

 ‘Order by’ keyword is used to sort the result set in ascending


or descending order.
 Syntax – select column from table_name order by
column asc/desc
 Example – select * from bba_4b order by marks desc;
 ‘Like’ command is used in a WHERE clause to search for a
specific pattern in a column.
 Syntax – select column from table_name where
column like ‘_%’
 Example – select * from bba_4b where name like ‘p%’

13 | P a g e
Write command for aggregate functions

 MySQL supports all the 5 ISO standard aggregate functions


i.e. count, sum, average, minimum, and maximum.
 Average (AVG) – this is used to find out average of total
entries recorded in a table.
 Syntax – select avg(column) from table_name
 Example – select avg(marks) from bba_4b
 Count – this is used to find out number of entries in a
column.
 Syntax – select count(column) from table_name
 Example – select count(marks) from bba_4b
 Maximum (MAX) – this is used to find out highest value of
total entries recorded in a table.
 Syntax – select max(column) from table_name
 Example – select max(marks) from bba_4b
 Minimum (MIN) – this is used to find out lowest value of
total entries recorded in a table.
 Syntax – select min(column) from table_name
 Example – select min(marks) from bba_4b

14 | P a g e
 Sum - this is used to find out total of all the entries recorded
in a table.
 Syntax – select sum(column) from table_name
 Example – select sum(marks) from bba_4b

Write commands for operator

 Less than – this operator is used to find all the values lower
than the certain value of the column.
 Syntax – select * from table_name where
column<’limit’
 Example – select * from bba_4b where marks<’92’;
 Greater than – this operator is used to find all the values
higher than the certain value of the column.

15 | P a g e
 Syntax – select * from table_name where
column>’limit’
 Example – select * from bba_4b where marks>’90’;
 Less than equal to - this operator is used to find all the
values either lower than or equal to the certain value of the
column.
 Syntax – select * from table_name where
column<=’limit’
 Example – select * from bba_4b where marks<=’92’;
 Greater than equal to - this operator is used to find all the
values either higher than or equal to the certain value of the
column.
 Syntax – select * from table_name where
column>=’limit’
 Example – select * from bba_4b where marks>=’90’;

16 | P a g e
 Between – this operator is to find number of values lying
between 2 certain values.
 Syntax – select * from table_name where column
between ’limit’ and ’limit’
 Example – select * from bba_4b where marks between
’88’ and ‘94’
 Like – this is used in a WHERE clause to search for a specific
pattern in a column.
 Syntax – select column from table_name where
column like ‘_%’
 Example – select * from bba_4b where name like ‘p%’

17 | P a g e
 IN – this is used to specify multiple values in a WHERE
clause.
 Syntax – select * from table_name where column IN
(value1, value2….)

6. Write command for and, or, not operator


 These are the operators to apply different conditions on a
command using the WHERE clause.
 AND – it is used when to fulfill all the conditions to run a
command.
 Syntax – select * from table_name where clause1 and
clause2.
 Example – select * from bba_4b where roll_no=’4’ and
name=’shrish’

18 | P a g e
 OR – it is used when to fulfill any one of the condition to run
a command.
 Syntax – select * from table_name where clause1 or
clause2.
 Example – select * from bba_4b where roll_no=’4’ or
name=’paras’
 NOT – it is used when to reject a condition in a command
 Syntax – select * from table_name where not clause1.
 Example – select * from bba_4b where not
name=’paras’

7. Write a command for indexes and views


 Indexes are special lookup tables and used to retrieve data
from database very fast.

19 | P a g e
 An index is used to speed up select queries and where
clauses.
 Syntax – create INDEX index_name
on table_name (column1, column2,…)
 Example – create INDEX roll_name
On bba_4b (roll_no, name)
 Views in SQL are considered as virtual table and also contain
rows and columns.
 A view can either have specific row based on certain
condition or all the rows of a table.
 Syntax – create VIEW view_name as select * from
table_name where condition
 Example - create VIEW details as select * from bba_4b
where roll_name=’5’

8. Write commands for Uppercase, Lowercase, Substring, Replace


 UPPERCASE – this command is to present the data in capital
letters (uppercase).
 Syntax – select upper(column) from table_name
 Example – select upper(name) from bba_4b

20 | P a g e
 LOWERCASE – this command is to present the data in small
letters (lowercase).
 Syntax – select lower(column) from table_name
 Example – select lower(name) from bba_4b
 SUBSTRING – this command is used to present only certain
characters of the value of the column from the table.
 Syntax – select substring (column, direction of letters,
number of letters) from table_name
 Example – select substring (name, 1, 3) from bba_4b
 Note – the (1, 3) means the first 3 letters of the name
 REPLACE – this command is used to change the case of
letter in a particular column
 Syntax – select replace (column, ’old letter’, ‘new
letter’) from table_name where condition
 Example – select replace (name, ‘p’, ‘P’) from bba_4b
where name=’prajjwal’ and name=’paras’

21 | P a g e
9. Write command for
 CONCAT – this command is used to add two or more strings
(words) or columns together.
 Syntax – select concat (string1, string2,…)
 Example – select concat (‘sql’, ‘ ‘, ‘is’, ‘ ‘, ‘fun’)
 LENGTH – this command return length of strings in bytes,
i.e. number of letters in a string.
 Syntax – select length (string)
 Example – select length (“SQL Tutorial”) as
lengthofstring;
 MONTH, DAYOFMONTH and YEAR – this command is used
to extract month, day, and year from any given date.
 Syntax – select DAYOFMONTH(column) as ‘name’,
MONTH(column) as ‘name’, YEAR(column) as ‘name’
from table_name;
 Example - select DAYOFMONTH(birth_date) as ‘day’,
MONTH(birth_date) as ‘month’, YEAR(birth_date) as
‘year’ from bba_4b;

22 | P a g e
10. Create employee table and perform following commands.
a) Eid, ename, desg, branch, salary, address.
b) Insert 10 records.
c) List employees whose salary is between 10,000 & 30,000.
d) Ename sould be unique.
e) Add column in table – date of joining, experience.
f) Delete column desg.
g) Find out details of employees whose salary is above 25,000.
h) Calculate total no. of records in employee table.

23 | P a g e
 List employees whose salary is between 10,000 -30,000.

 Add column in table – date of joining, experience.


 Delete column desg.

 Details of employees whose salary is above 25,000.

24 | P a g e
 Total no. of records in employee table.

11. Create the following table and perform SQL commands on


STUDENT (roll no., name, age, course, marks)
a) Select student name where age is greater than 18 and
course MBA.
b) Show the name of student using like command.
c) Find out name, course, marks from student by marks in
ascending order.
d) Find out student with max marks
e) Find out the name of student by roll no. in descending order.
f) Find out average of all marks

25 | P a g e
 Student name where age is greater than 18 and course MBA

 name, course, marks from student by marks in ascending order.

 Show the name of student using like command.

26 | P a g e
 the name of student by roll no. in descending order.

 student with max marks


 average of all marks

12. Create the following tables and insert 10 records in each


A. Supplier (s no., sname, status, city)
B. Parts (p no., color, weight, city)

Answer the following queries in SQL

a) Find suppliers for the city Delhi


b) Find all suppliers whose name start with ab
c) Find all suppliers whose status is 10, 20, or 30
d) Find all suppliers whose status is 10, 20, or 30

27 | P a g e
 Supplier table –

 Parts table –

 suppliers for the city Delhi


 all suppliers whose name start with ab
 all suppliers whose status is 10, 20, or 30
 all suppliers whose status is 10, 20, or 30

28 | P a g e
29 | P a g e
13. What do you understand by ER Modeling?
 Entity Relationship(ER) model is a concept that describes the
structure of database with the help of a diagram called Entity
Relationship(ER) diagram.
 ER model is a blueprint or a design of the database that can be
implemented on the database later on.

Components of
Entity Relation
ER model ship

Attribute

 ENTITY – It is an object or component of data. It is represented


in a rectangle shape in ER diagram. All the entities are
interlinked with each other. Example – student and college.
 Weak entity – it is an entity which does not have its own
unique attributes and also rely on other entities. Example
– bank account relies on bank.
 Strong entity – it is an entity with its own attributes.
Example – college, bank, hospital, etc.
 Types of entities can be – product, customer, location, or
promotion.
 ATTRIBUTE – it is described as a property of an entity. It is
represented in an oval shape in ER diagram.

30 | P a g e
Pin code
Name Student Address

State
Phone n.
Age

 Key attributes – it can uniquely identify an entity from


entity set. Example – name, roll no.
 Composite attribute – it is a combination of different
attributes. Example – address is a combination of city
name, pin code, state, residence no.
 Multivalued attributes – it can hold multiple values.
Example – student having multiple phone no., email ids.
It is presented in double oval.
 Derived attributes – it is derived from other attributes.
Example – age is derived from date of birth.
 RELATIONSHIP – it shows the association between two or more
entities. It is represented in a diamond shape.
 One to one – when single entity is associated with one
other entity.

Work
Student Student
with

 One to many – when one entity is associated with many


other entities.

31 | P a g e
College has Student

 Many to one – when many entities are associated with


one entity.

Student Go to College

 Many to many – when many entities are associated with


many other entities.

Student Work Project


on

32 | P a g e
14. Explain all the symbols of ER model with
examples.
 RECTANGLES – they are used to represent entities. Ex –
students, college, staff, faculty, etc.
 ELLIPSES – they are used to represent attributes. Ex – names,
roll no., course, city, pin code, etc.
 DIAMONDS – they are used to represent relationships. Ex –
work, has, go to, enrolls, etc.
 LINES – it links attributes to their entities and entities with their
relationships.
 PRIMARY KEY – they are the attributes which are underlined
and unique.
 DOUBLE ELLIPSES – they are the multivalued attributes. Ex –
phone no., email ids, etc.
15. Draw ER diagram of an organization.

has Organization work

Name Address

has

Name Departments Dep id

has

Name Address Name Age


Name Proj id

Branches has Employees work Projects


33 | P a g e
16. Draw Entity Relationship diagram of a banking system.

has Bank has

Name Address

has
Cash
Address Name Type limit Address
Balance

User has Account use ATM

use

17. Draw Entity Relationship diagram of a hospital management


system.

has Hospital has Pharmacy


Name Address Supplier Bill no.
has
Name

Salary Doctor give

Qualification
treats
Room no. Type Name Usage
Name Pat. id

Rooms Assign Patient get Medicine


to
34 | P a g e
18. Draw Entity Relationship diagram of a university.

Name
University provide

Address
has

Name

has Colleges
Address

has
Name Salary Name S. id Name Subjects

Faculty teach Students enroll Course

35 | P a g e

You might also like