0% found this document useful (0 votes)
51 views20 pages

Abhay Krishan - ISM LAB Converted 1 20

SQL is used to communicate with a database and is the standard language for relational database management systems. SQL statements are used to perform tasks such as update or retrieve data from a database. The standard SQL commands like Select, Insert, Update, Delete, Create, and Drop can accomplish most tasks needed with a database. SQL features include procedural language statements, support for control flow logic, ease of implementation using a simple typed language, reliability compared to external functions, and support for parameters and condition handling.

Uploaded by

tushar rawat
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)
51 views20 pages

Abhay Krishan - ISM LAB Converted 1 20

SQL is used to communicate with a database and is the standard language for relational database management systems. SQL statements are used to perform tasks such as update or retrieve data from a database. The standard SQL commands like Select, Insert, Update, Delete, Create, and Drop can accomplish most tasks needed with a database. SQL features include procedural language statements, support for control flow logic, ease of implementation using a simple typed language, reliability compared to external functions, and support for parameters and condition handling.

Uploaded by

tushar rawat
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/ 20

INSTITUTE OF INNOVATION IN TECHNOLOGY AND MANAGEMENT

ISM LAB FILE


BBA-2022

Submitted To: Submitted By:

Mr Himanshu Pabbi Name: Abhay Krishan

Assistant Professor, IINTM Rollno: 12224401719


Class & section: E3
Institute of Innovation in Technology & Management, New Delhi

LIST OF PRACTICALS FOR (ISM)

Programme: BBA Semester: 4th Paper Code lab: 212 Session -2019

Assignment No Topic Signature/


Remarks

Assignment 1 What is SQL? Features of SQL


Data types in SQL
Create table student
Basics of SQL &
DDL Commands
Modify the structure of student table
Create table Employee
Modify the structure of Employee table
Assignment 2 Create table customer
Insert 5 rows each using all the three methods
Display the contents
Display CID and Fname
Display Fname,Lname and state
Display all records where state is Delhi
Display fname, lname concatenated with state
Display the records whose pin is not entered
Display the states to which the customer belongs
Select records of Delhi having name Rajiv
Display records delhi or Karnataka
Display details of Customer with CID=98
DML Commands
Display details of Customer except CID=98
Use Alias Name to display CID
Retrieve all rows where CID is between 98 and 100
Display those rows where state name begins with ‘D’
Retrieve all rows where first name contains the word’RAJ’
Retrieve all rows where name field contains the word’RA ESH’
Retrieve all rows where city is Delhi, Karnataka or Bangalore
Rename the table customer to cust
Delete all those rows of customers who stay in Bangalore
Delete those customers who do not have Pin Code
Rename column city to address
Delete the customers who do not belong to Bangalore
Create table employee
Assignment 3
Insert 5 records
List name of all employees who work in Dept No. 5
Find names and salary of all the employees sorted according to salary
List names of employees having salary between 30,000 and 50,000
List name of employees who live in Janakpuri
List name of all female employees
List name of those employees whose bdate is before 2 Nov. 1996
Advanced DML List all employees whose fname is “Ram” and lName is “Kapoor”
Commands Rename the column address to city
Sort the employees in descending order of city
Update the person named “Ram” to “Vikas”
Update city of empid 101 to Jaipur
Delete record of empid 102
Display those employees whose salary is not equal to 20,000
Assignment 4 Create table employee
Insert 5 records in employee table
Find average and total salaries of all employees
Find average and total salaries of each employee dept wise
Find minimum salary of Manager
Find the maximum salary of the Manager
How many employees are Managers
Add 50% salary to salary column and name it HRA
Count the total no. employees
Count the no. of departments available
Aggregate /
Count the no. of employees in each department
Grouping
Functions Update the commission to 10%of salary for all the employees having salary
greater than 50000
Find the name of lowest paid employee for each dept
Update the salaries of all employees in department 10 by hiking it by 15%.
Find the difference between highest and lowest salaries for each dept
List average salary for all the depts which have more than 5 People
List jobs of all the employees where maximum salary is more than 40000
List jobs and no. of employees in each job
List average salary of each job excluding managers
List total, Max, Min, Average salary of employees job wise
Assignment 5 1. Create table course with fields:ccode(PK), cname(Unique),fee
2. Create table student with following fields: RollNo(PK), Sname, DOB(not
Null), Coursecode(FK), Year of admission
3. Insert 5 records in each table
4. Find the age of the students
5. Find the roll no, Name, course name of every student
6. Find the details of the students who are in Python course
7. Find the list of students who have taken admission in the same year
8. Find the number of students who have taken admission year wise
9. Find the details of the students who are in the course in which student
with roll no 101 studies
10. Find the details of the students who have paid the fees for the costliest
course.

Assignment 6 1. Create table hotel and insert 3 records for the following attributes:- Hotelno
(primary key), Hotelname, city
2. Create table Room and insert 3 records for the following fields:- Room
no(primary key), hotelno(foreign key), type of room, price
3. Create table guest and insert 3 records into table:- Guest no(primary key),
gname, gaddress
4. Create table booking and insert 3 records for the following fields- Hotelno -
foreign key),guestno(foreign key),datefrom,dateto,roomno
5. Find average price of a room
6. List name and address of guest with booking for a hotel in ‘delhi’ ordered by
name
7. Find total income of all rooms of the hotel in Mumbai
8. List names of guest at hotel TAJ
9. Increase price of rooms of TAJ to 10%
10. Count the no of rooms of each type

Assignment 7 1. Create a table employee with following attributes eno(Primary Key) ,ename
,ecity, salary, deptno
2. Insert 5 records
3. Create a view having ename and ecity.
4. In the above view update the ecity to ‘Delhi’ where ename is ‘John’.
5. Insert a row in the view and see if it is visible in table created.
6. Create view containing ename,city,deptno and salary and update the view by
increasing the salary of all employees of department no 10 by Rs.1000.
7. Create view having details of employee working in deptno=10
8. Create a view having grouping functions like max(sal)and min(sal)
9. Update the above view and set the max salary to 90000.Observe the result.
10. Delete the view created

Assignment 8 1. Give Syntax and Queries to demonstrate the use of following Numeric
functions in System Defined Table
• Absolute
• Power
• Trunc
• Greatest
• Least
• sqrt
• Log
• Sin
• Cos
• Tan
• Round
• Floor
• Ceil
Assignment 9
Create entity relationship diagrams between three tables using MS-Access
E-R Diagram

Name & Signature of Faculty Programme Director IQAC Coordinator Director


ISM LAB FILE

ASSIGNMENT 1

Ques 1) What is SQL? Features of SQL.


Ans) SQL stands for Structured Query Language. SQL is used to communicate
with a database. According to ANSI (American National Standards Institute), it
is the standard language for relational database management systems. SQL
statements are used to perform tasks such as update data on a database, or
retrieve data from a database. However, the standard SQL commands such as
"Select", "Insert", "Update", "Delete", "Create", and "Drop" can be used to
accomplish almost everything that one needs to do with a database.
Features:

• Can contain SQL Procedural Language statements and features which


support the implementation of control-flow logic around traditional
static and dynamic SQL statements.
• Are easy to implement, because they use a simple high-level, strongly
typed language.
• SQL functions are more reliable than equivalent external functions.
• Support input parameters.
• SQL scalar functions return a scalar value.
• SQL table functions return a table result set.
• Support a simple, but powerful condition and error-handling model.
• Allow you to easily access the SQLSTATE and SQLCODE
values as special variables.
• Reside in the database and are automatically backed up and restored as
part of backup and restore operations.
• Can be invoked wherever expressions in an SQL statement are supported.
• Support nested functions calls to other SQL functions or functions
implemented in other languages.

Ques 2) Data types in SQL.

Ans) 1) CHAR (size)- A FIXED length string (can contain letters, numbers,
and special characters). The size parameter specifies the column length in
characters - can be from 0 to
255. Default is 1.

2) VARCHAR (size)- A VARIABLE length string (can contain letters, numbers.

ENROLLMENTNO. P a g e 6 | 71
12224401719
ISM LAB FILE

3) special characters). The size parameter specifies the maximum column length
in characters
- can be from 0 to 65535.

4) BINARY (size)- Equal to CHAR(), but stores binary byte strings. The
size parameter specifies the column length in bytes. Default is 1.

5) VARBINARY (size)- Equal to VARCHAR(), but stores binary


byte strings. The size parameter specifies the maximum column
length in bytes.

ENROLLMENTNO. P a g e 7 | 71
12224401719
ISM LAB FILE

6) TEXT (size)- Holds a string with a maximum length of 65,535 bytes.

7) MEDIUMTEXT- Holds a string with a maximum length of 16,777,215


characters.

8) LONGTEXT- Holds a string with a maximum length of 4,294,967,295


characters.

Ques 3) Create table


student. Ans) Steps:
• Create table abhaykrishan_student(Name char(10),Roll
number(5),Course char(12),DOB date)
• Desc abhaykrishan_student

Ques 4) Modify the structure of


student table. Ans) Steps:
• Alter table abhaykrishan_student add(section char(5),contact number(10))
• Desc abhaykrishan_student

ENROLLMENTNO. P a g e 8 | 71
12224401719
ISM LAB FILE

Ques 5) Create table


Employee. Ans) Steps:
• Create table abhaykrishan_employee(EMPID number(5), EMPNAME
char(20), DESG char(10), DOJ date)
• Desc abhaykrishan_employee

ENROLLMENTNO. P a g e 9 | 71
12224401719
ISM LAB FILE

Ques 6) Modify the structure of


employee table. Ans) Steps:
• Alter table abhaykrishan_employee add(SALARY Number(7))
• Desc abhaykrishan_employee

ASSIGNMENT 2
Ques 1) Create table
customer. Ans) Steps:
• Create table abhaykrishan_customer(CID number(3), FName char(10),
LName char(10), City char(10), PIN number(5), State char(7))
• Desc abhaykrishan_customer

ENROLLMENTNO. P a g e 10 | 71
12224401719
ISM LAB FILE

Ques 2) Insert 5 rows each using all the three


methods. Ans) Steps:
• Insert into abhaykrishan_customer values(101,'Megha','Sharma','New Delhi',
11005 'Delhi')
• Insert into abhaykrishan_customer values(102,'Saskshi','Gupta','New Delhi',
11006,'Delhi')
• Insert into abhaykrishan_customer values(103,'Arushi','Sharma','New Delhi',
11008,'Delhi')
• Insert into abhaykrishan_customer values(104,'Priya','Kapoor','Punjab',
11003,'Delhi')
• Insert into abhaykrishan_customer
values(105,’Ishmeen’,’Kaur’,’Punjab’,11007,’Delhi’)
• Select* from abhaykrishan_customer

ENROLLMENTNO. P a g e 11 | 71
12224401719
ISM LAB FILE

Ques 3) Display the contents.


Ans) Select* from
abhaykrishan_customer

ENROLLMENTNO. P a g e 12 | 71
12224401719
ISM LAB FILE

Ques 4) Display CID and FName.

Ans) Select CID,FNAME from abhaykrishan_customer

Ques 5) Display Fname, Lname and State.

Ans) Select FNAME, LNAME, STATE from abhaykrishan_customer

ENROLLMENTNO. P a g e 13 | 71
12224401719
ISM LAB FILE

Ques 6) Display all records where state is Delhi.

Ans) Select * from abhaykrishan_customer where STATE= 'Delhi'

Ques 7) Display FName, LName concatenated with state.


Ans) Select FNAME || LNAME || state as “customer and their
location” from abhaykrishan_customer

ENROLLMENTNO. P a g e 14 | 71
12224401719
ISM LAB FILE

Ques 8) Display the records whose pin is not


entered. Ans) Steps:
• Select * from abhaykrishan_customer where pin is null

Ques 9) Display the states to which the customer


belongs. Ans) Select distinct state from
abhaykrishan_customer

ENROLLMENTNO. P a g e 15 | 71
12224401719
ISM LAB FILE

Ques 10) Select records of Delhi having name Kyza.


Ans) Select* from abhaykrishan_customer where FNAME= ‘Megha’ and
STATE=’Delhi’

Ques 11) Display records Delhi or Korea.


Ans) Select* from Shefali_customer where state= ‘Delhi’ or state= ‘Calcutta’

ENROLLMENTNO. P a g e 16 | 71
12224401719
ISM LAB FILE

Ques 12) Display details of customer with


CID= 101 Ans) Select* from
abhaykrishan_customer where CID= 101

Ques 13) Display details of customer except


CID=101
Ans) Select* from Shefali_customer where not
CID= 101

ENROLLMENTNO. P a g e 17 | 71
12224401719
ISM LAB FILE

Ques 14) Use alias name to display CID.


Ans) Select CID as “Customer number” from abhaykrishan_customer

Ques 15) Retrieve all rows where CID is between 101


and 106
Ans) Select* from abhaykrishan_customer where CID
between 101 and 106

ENROLLMENTNO. P a g e 18 | 71
12224401719
ISM LAB FILE

Ques 16) Display those rows where state name begins


with ‘D’ Ans) Select* from abhaykrishan_customer
where STATE like ‘D%’

Ques 17) Retrieve all rows where first name contains the word ‘MEG’ Ans)
Select* from abhaykrishan_customer where FName like ‘Meg%’

ENROLLMENTNO. P a g e 19 | 71
12224401719

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy