BCA - Semester -2 - Bhulabhai Vanmalibhai Patel Institute of...

42
BCA - Semester -2 2014 Ms.Preeti P. Bhatt Page 1 Practical Problem 030010202: Relational DBMS Practical No: 1 Enrollment No: Group : A Practical Problem Create the following table: Student(S_id,Sname,City,State,Contactno,Pincode) Insert at least five sample records: Perform following queries: 1. Display student name and city. 2. Display students detail whose city first letter start with ‘S’. 3. Remove students that stay at “Navsari” city. 4. Change student id “S008” to “S007”. 5. Display students detail whose city is “Surat” or “Navsari”. Objective(s) To understand the concept of DBMS query. Pre-requisite To know basic DBMS commands CREATE,SELECT,UPDATE and DELETE Duration for completion 1 hour PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solve industry problems. PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessary for software development. CO(s) to be achieved CO1: Differentiate DBMS & RDBMS and use SQL data types. Solution must contain Query statements with output Nature of submission Handwritten References for solving the problem Beginning DB2: From Novice to Professional, Allen G. http://w3schools.com/Sql/ Post Laboratory questions Post Laboratory questions: 1. Give differences between CHAR and VARCHAR datatype. 2. What is use of DELETE statement? 3. Can we remove pincode attribute from student table using DELETE statement? 4. Write query to display students detail whose city end with letter ‘t’. Assessment Solution achieves the desired objective(s) Viva Out of Marks 10 5 Secured by the student Signature Date

Transcript of BCA - Semester -2 - Bhulabhai Vanmalibhai Patel Institute of...

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 1

Practical Problem030010202: Relational DBMSPractical No: 1 Enrollment No: Group : APractical Problem Create the following table:

Student(S_id,Sname,City,State,Contactno,Pincode)Insert at least five sample records:Perform following queries:

1. Display student name and city.2. Display students detail whose city first letter start with ‘S’.3. Remove students that stay at “Navsari” city.4. Change student id “S008” to “S007”.5. Display students detail whose city is “Surat” or “Navsari”.

Objective(s) To understand the concept of DBMS query.

Pre-requisite To know basic DBMS commands CREATE,SELECT,UPDATE and DELETE

Duration for completion 1 hour

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO1: Differentiate DBMS & RDBMS and use SQL data types.

Solution must contain Query statements with output

Nature of submission Handwritten

References for solvingthe problem

Beginning DB2: From Novice to Professional, Allen G.

http://w3schools.com/Sql/

Post Laboratoryquestions

Post Laboratory questions:1. Give differences between CHAR and VARCHAR datatype.2. What is use of DELETE statement?3. Can we remove pincode attribute from student table using

DELETE statement?4. Write query to display students detail whose city end with

letter ‘t’.Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 2

Practical No: 2 Enrollment No: Group : APractical Problem Create the following table:

Supplier (Supplier_Id,Supplier_Name,City,Contact_Number,State)Item (Item_Id,Item_Name,Quantity,Colour,Supplier_Id,MFG_Date)Make Supplier_Id of Supplier &Item_Id of Item table as Primary key.Apply necessary constraints while creating tables.

Supplier_Id as foreign key in Item table. Quantity should be between 50 and 100. City must be from “Surat”,”Bardoli”,”Baroda”,”Navsari”. Supplier_ID should be start with ‘S’.

Insert at least five records in each tables:Perform following queries:

1. Change the item_id ‘I004’ whose Supplier_Name is “Smith”.2. Find Item_Name having quantity more than 150 and colour

“Red”.3. Display supplier city who supply Item_Name “Eraser”.4. List the supplier name who supply item having initial

character as ‘A’.5. Display total item from each supplier wise.

Objective(s) To understand the concept of Join and GROUP BY clause.

Pre-requisite To knowledge about joins and GROUP BY clause.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO1: Differentiate DBMS & RDBMS and use SQL data types.

Solution must contain Query statements with output

Nature of submission Handwritten

References for solvingthe problem

Beginning DB2: From Novice to Professional, Allen G.

http://w3schools.com/Sql/

Post Laboratoryquestions

Post Laboratory questions:1. What is use of JOIN clause?2. Solved 3rd query without JOIN clause.3. Can JOIN work with update statement?4. Solved 1st query with use of sub-query.

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 3

Practical No: 3 Enrollment No: Group : APractical Problem 1. Consider student table of practical problem-1 of group-A

a. Write a block that accept S_id from user and displayContactno of that student.(Use concept of anchordatatype)

b. Write a block to insert the user inputted value intostudent table using row variable.

2. Do as directeda. Create an array to store name of 20 students.b. Write a block that accept 5 names from the user and

store in above created array and display cardinality ofthat array.

Objective(s) To know the syntax of all data types.

Pre-requisite To understand the concept of RDBMS data types.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO1: Differentiate DBMS & RDBMS and use SQL data types.

Solution must contain Data types statements.

Nature of submission Handwritten

References for solvingthe problem

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. Perform q-1(b) without using row variable.2. Can ANCHOR data type work like row of table or view?3. Which clause is used to define ANCHOR datatype?4. Consider q-3 (2(b), if I store value from the last index then

what is cardinality of an array?

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 4

Practical No: 4 Enrollment No: Group : APractical Problem

1) Write SQL/PL block that accept string from user and find outthe length of these string.

2) Write SQL/PL block that that accepts five subject marks as ainput. Find percentagePrint message using following condition.1) >= 70 then “Distinction”2) >=60 then “First class”3) >= 50 then “Second class”4) >= 40 then “Pass class”5) <40 then “Fail”

3) Write SQL/PL block that accept two numbers from user andprint summation, multiplication.

Objective(s) To understand the concept of IF statement.

Pre-requisite Students able to understand the working and use of if statement.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO2: Use of IF, CASE, FOR, LOOP, WHILE and REPEAT control flowstatements.

Solution must contain SQL /PL block with output

Nature of submission Handwritten

References for solvingthe problem

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. What changes is required in block N0.-3 to display subtraction

of two numbers?2. List out all forms of if statement.3. What changes will be made in block no two if passing

percentage is less than 50?4. What package is used to display output?

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5

Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 5

Practical No: 5 Enrollment No: Group : APractical Problem 1) Write SQL/PL block that taken input as five subject marks.

Find percentage( using case statement)Print message using following condition.

Percentage >= 70 then “Distinction”Percentage >=60 then “First class”Percentage >= 50 then “Second class”Percentage >= 40 then “Pass class”

Percentage< 40 then “Fail”

Objective(s) To understand the concept of case statement.

Pre-requisite Students able to understand the working and use of case statement.

Duration for completion 1 hour

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO2: Use of IF, CASE, FOR, LOOP, WHILE and REPEAT control flowstatements

Solution must contain SQL /PL block with output

Nature of submission Handwritten

References for solvingthe problem

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. What is search case statement?2. What changes will be made in block no two if passing

percentage is less than 50?3. Which sign is used to taken input from user?4. What is advantage of case statement over if statement?

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 6

Practical No: 6 Enrollment No: Group : APractical Problem Write a SQL/PL code block to calculate the area of circle for a value of

radius varying from 3 to 7.

Store the radius and the corresponding values of calculated area in anempty table named Circle_Area, consisting of two columns Radius andArea.

Objective(s) To know the use of while statement.

Pre-requisite To understand the looping concept.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO2:Use of IF, CASE, FOR, LOOP, WHILE and REPEAT control flowstatements.

Solution must contain Block using while loop

Nature of submission Handwritten

References for solvingthe problem

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. What is the use of while loop?2. When while loop is terminated?3. What change can be done if we find area of circle from radius

5 to 10?4. Which statement is compulsory for while loop?

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 7

Practical No: 7 Enrollment No: Group : APractical Problem Consider table : Employee (Id, Name, Salary, Department)

Write block to count number of employee of marketing departmentwhose salaryLess than 10000, 10000-20000, 20000-30000, above 30000.

Example : Display message likesalary less than 10000 = 0salary between 10000-20000 = 1salary between 20000-30000 = 1salary greater than 30000 = 2

Objective(s) To know the use of for statement.

Pre-requisite To understand the looping concept.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO2:Use of IF, CASE, FOR, LOOP, WHILE and REPEAT control flowstatements.

Solution must contain Block using for loop.

Nature of submission Handwritten

References for solvingthe problem

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. What is the use of for loop?2. When for loop is terminated?3. Which data type is used to store record from for loop?4. What changes can be made in above problem if want to fetch

no of employee of “Finance” department?Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 8

Practical No: 1 Enrollment No: Group : BPractical Problem Create the following table:

Person(P_id,Pname,City,State,Contactno,Age,Pincode)Insert at least five records:Perform the queries:

1. Display person detail whose age greater than 25.2. Display person detail whose name second letter is‘p’.3. Show person name whose age range is 20 to 35.4. Display unique city from person table.5. Display person detail whose city is “Surat” and age less than

40.

Objective(s) To understand the concept of DBMS.

Pre-requisite To know basic DBMS commands CREATE,SELECT,UPDATE and DELETE

Duration for completion 1 hour

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO1: Differentiate DBMS & RDBMS and use SQL data types.

Solution must contain Query statements with output

Nature of submission Handwritten

References for solvingthe problem

Beginning DB2: From Novice to Professional, Allen G.

http://w3schools.com/Sql/

Post Laboratoryquestions

Post Laboratory questions:1. Give differences between DROP and DELETE statement.2. Which operator use as pattern matching?3. What changes can be made in 5th query of above question if

want to display person form “Baroda” city whose age greaterthan 60?

4. List out all logical operator.Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 9

Practical No: 2 Enrollment No: Group : BPractical Problem Create the following table:

Customer (Cust_id, Cust_name, City, Cust_Birthdate)Bank_Account (A_id, A_type, Branch_name, Branch_Location, Cust_id)Apply necessary constraints while creating tables.

Cust_id of Customer & Account_id of Bank_Account table asPrimary key.

Cust_id as foreign key in Bank_Account table. Account type must be “Current” or “Saving”.

Insert at least five records in each tables &Perform following queries:1. Find the length of all customers name.2. Display total customer in each branch.3. Change the city of cust_id “Coo4” to “Navsari”.4. Display customer name and birthdate whose account type

“Current”.5. Show customer details that are located in “Bardoli” or

“Surat”. (Note: Do not use OR operator).6. Show all customers whose birthdate range between

“12/10/1970” to “13/10/1985”.Objective(s) To understand the concept of JOIN and GROUP clause.

Pre-requisite To knowledge about joins and GROUP by clause.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO1: Differentiate DBMS & RDBMS and use SQL data types.

Solution must contain Query statements with output.

Nature of submission Handwritten

References for solvingthe problem

Beginning DB2: From Novice to Professional, Allen G.

http://w3schools.com/Sql/

Post Laboratoryquestions

Post Laboratory questions:1. Solved 4th query using sub-query.2. Is space character is counted while finding length of string?

Explain with example.3. Solved 5th query without using OR operator.4. List out aggregate function.

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 10

Practical No: 3 Enrollment No: Group : BPractical Problem 1. Consider person table of practical problem-1 of group-B.

a. Write a block that accept P_id from user and display Ageof that person.(Use concept of anchor datatype)

b. Write a block to insert the user inputted value intoperson table using row variable.

2. Do as directeda. Create an array to store phone No. of 20 person.b. Write a block that accept 5 contacts No. from the user

and store in above created array and display cardinalityof that array.

Objective(s) To know the syntax of all data types.

Pre-requisite To understand the concept of RDBMS data types.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO1: Differentiate DBMS & RDBMS and use SQL data types.

Solution must contain Data types statements.

Nature of submission Handwritten

References for solvingthe problem

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. Which different SQL object created using Anchor data type?2. Which clause is used when anchor data type is row data type?3. Solve q-1(b) without using row variable.4. Consider q-3 (2(b), if I store value from the 3rdindex then what

is cardinality of an array?Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 11

Practical No: 4 Enrollment No: Group : BPractical Problem student (Id, Name, Marks, Bonus)

Id Name Totalmarks

Bonus

1 Smith 85 0

2 John 90 0

3 Rohan 50 0

(Note: Accept student id from user)1) Write block that accept student id from user andgive 5 marks as bonus

if total marks greater than 90.2) Write block that accept student id from user and give 2 marks as bonus

if total marks less than 50.3) Write the blockthat accept student id from user and perform following

condition.a. If the total marks are greater than 80 and less than 90then give 6

marks as bonus marks.b. If the total marks are greater than 40 and less than 60 then give 3

marks ad bonus marks.c. If above condition is not satisfied then no bonus marks are given.

Objective(s) To understand the concept of IF statement.

Pre-requisite Students able to understand the working and use of if statement.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessary forsoftware development.

CO(s) to be achieved CO2: Use of IF, CASE, FOR, LOOP, WHILE and REPEAT control flow statements.

Solution must contain SQL /PL block with output

Nature of submission Handwritten

References for solvingthe problem

DB2 9 for Linux, UNIX and Windows DBA guide, reference and Exam Prehttp://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. Consider problem-4(1), what changes can be made to give 5% of

total marks as a bonus instead of 5 marks.2. List out different form of if statement.3. What are differences between IF and CASE statement?4. In which condition ELSE block is executed?

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 12

Practical No: 5 Enrollment No: Group : BPractical Problem Use student table of problem -4

Write the block for the following condition (using the case statement )a. If the total marks are greater than 80 and less than 90then

give 6 marks as bonus marks.b. If the total marks are greater than 40 and less than 60 then

give 3 marks as bonus marks.c. If no any condition satisfied then no any bonus marks

applied.

Objective(s) To understand the concept of CASE statement.

Pre-requisite Students able to understand the working and use of case statement.

Duration for completion 1 hour

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO2: Use of IF, CASE, FOR, LOOP, WHILE and REPEAT control flowstatements.

Solution must contain SQL /PL block with output

Nature of submission Handwritten

References for solvingthe problem

DB2 9 for Linux, UNIX and Windows DBA guide, reference and ExamPrep.http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. What is case statement?2. Consider problem 5(a), what changes can be made to give 6%

of total marks as a bonus instead of 6 marks?.3. Which one is better between case and if statement? Why?4. If no any condition satisfied, then which block is executes in

case statement?Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 13

Practical No: 6 Enrollment No: Group : BPractical Problem Write a SQL/PL code block to calculate the area of square for a value of

length varying from 10 to 20.

Store the length and the corresponding values of calculated area in anempty table named Square_Area, consisting of two columns Length andArea.

Objective(s) To know the use of while statement.

Pre-requisite To understand the looping concept.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO2:Use of IF, CASE, FOR, LOOP, WHILE and REPEAT control flowstatements.

Solution must contain Block using while loop

Nature of submission Handwritten

References for solvingthe problem

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. What is the use of while loop?2. When while loop is terminated?3. What change can be done if we find area of square from

radius 5 to 10?4. Which statement is compulsory for while loop?

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 14

Practical No: 7 Enrollment No: Group : BPractical Problem Consider table : Project (Pid, Pname, Total_Employee, Type)

Type should be Internal /external.

Write a block to count of internal project handled by1 employee, 2- 5 employees, 6-10 employees, more than 10 employees.Example : display message likeProject handled by 1 employee = 2Project handled by 2-5 employees = 4Project handled by 6-10 employees = 5Project handled by more than 10 employees = 2

Objective(s) To know the use of for statement.

Pre-requisite To understand the looping concept.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO2:Use of IF, CASE, FOR, LOOP, WHILE and REPEAT control flowstatements.

Solution must contain Block using for loop.

Nature of submission Handwritten

References for solvingthe problem

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. What is the use of for loop?2. When for loop is terminated?3. Which data type is used to store record from for loop?4. What changes can be made in above problem to countall

project instead of internal project?Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 15

Practical No: 1 Enrollment No: Group : CPractical Problem Create the following table:

Customer(Cid, Cname, City ,State ,Birthdate ,Pincode)Insert at least five records:Perform the queries:

1. Display total customer.2. Display customer detail whose state is “Gujarat”.3. Remove customer that stay at “Mumbai” city.4. Display customer name whose birthdate range during

“13/1/1980” to “13/1/1989”.5. Display customer detail whose last character of customer

name is ‘a’.

Objective(s) To understand the concept of DBMS.

Pre-requisite To know basic DBMS commands CREATE,SELECT,UPDATE and DELETE

Duration for completion 1 hour.

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development

CO(s) to be achieved CO1: Differentiate DBMS & RDBMS and use SQL data types.

Solution must contain Query statements with output

Nature of submission Handwritten

References for solvingthe problem

Beginning DB2: From Novice to Professional, Allen G.

http://w3schools.com/Sql/

Post Laboratoryquestions

Post Laboratory questions:1. Which datatype is fixed length data type?2. Which wild card characters use in LIKE operator?3. What is use of primary key?4. What is use of LOWER() function?

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 16

Practical No: 2 Enrollment No: Group : CPractical Problem Create the following table:

Garment (App_no , Name, Size, Mfg_date, Supplier_id)Supplier (Supplier_id, Name, City, State, Contactno)Apply necessary constraints while creating tables.1. MakeApp_no of garment &Supplier_id of supplier table as Primary key.2. Supplier_id as foreign key in garment table.3. City must be from “Ahmedabad”,”Baroda”and”Surat”.

Insert at least five records in each tables:Perform following queries:

1. How many suppliers come from city”Baroda” or “Surat”.2. Display the total size of each supplier.3. Find the length of all supplier name4. Display city for supplier whose name is “smith john” and statestarts with letter ‘G’.5. Delete garment details whose mfg_dateis less than “12/11/2013”.

Objective(s) To understand the concept of JOIN and GROUP BYclause.

Pre-requisite To knowledge about joins and GROUP by clause.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessary forsoftware development

CO(s) to be achieved CO1: Differentiate DBMS & RDBMS and use SQL data types.

Solution must contain Query statements with output

Nature of submission Handwritten

References for solvingthe problem

Beginning DB2: From Novice to Professional, Allen G.

http://w3schools.com/Sql/

Post Laboratoryquestions

Post Laboratory questions:1. Which data type called variable length data type?2. Write a point of difference between count and count (*) function?3. What is use of % wild card in LIKE operator?4. What changes can be made in 5th query of above question if want to

delete garment details whose date of manufacturing is before 2years from current date.

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 17

Practical No: 3 Enrollment No: Group : CPractical Problem 1. Consider person table of practical problem-1 of group-C.

a. Write a block that accept C_id from user and displayBirthdate of that customer.(use concept of anchordatatype)

b. Write a block to insert the user inputted value intocustomer table using row variable.

2. Do as directeda. Create an array to store birthdate of 20 customers.b. Write a block that accept 5 birthdates from the user and

store in above created array and display cardinality ofthat array.

Objective(s) To know the syntax of all data types.

Pre-requisite To understand the concept of RDBMS data types.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development

CO(s) to be achieved CO1: Differentiate DBMS & RDBMS and use SQL data types.

Solution must contain Data types statements.

Nature of submission Handwritten

References for solvingthe problem

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. What is ANCHOR variable?2. Which datatype is used to for index of associative array?3. Perform q-1(b) without using row variable.4. Consider q-3 (2(b), if I store value from the 5th index then

what is cardinality of an array?Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 18

Practical No: 4 Enrollment No: Group : CPractical Problem Employee (Id, Name, Salary, Department)

Id Name Salary Department

1 Smith 10000 Production

2 John 20000 Sales

3 Rohan 25000 Production

(Note: Accept user id from user)1) Write block for update salary with increase 10% whose salary is less

than 20000.2) Write block for update salary with reduce 10% whose salary is

greater than 25000.3) Write the block for the following condition (using the if..else condition)a. If the salary is greater than 10000 and less than 20000 then give

increment with Rs.1000.b. If the salary is greater than 20000 and less than 25000 then give

increment with Rs.2000.c. If the salary is greater than 25000 and less than 40000 then give

increment with Rs.3000.Objective(s) To understand the concept of IF statement.

Pre-requisite Students able to understand the working and use of IF statement.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessary forsoftware development.

CO(s) to be achieved CO2: Use of IF, CASE, FOR, LOOP, WHILE and REPEAT control flow statements.

Solution must contain SQL /PL block with output

Nature of submission Handwritten

References for solvingthe problem

DB2 9 for Linux, UNIX and Windows DBA guide, reference and Exam Prep.http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. What is use of if statement?2. How to terminate if statement?3. In first block how many rows changed in emp table?4. In second block if salary is greater than 35000 then how many rows

are modified?Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 19

Practical No: 5 Enrollment No: Group : CPractical Problem Use above employee table

Write the block for the following condition (using the case statement )a. If the salary is greater than 10000 and less than 20000 then

give increment with Rs.1000.b. If the salary is greater than 20000 and less than 25000 then

give increment with Rs.2000.c. If the salary is greater than 25000 and less than 40000 then

give increment with Rs.3000.

Objective(s) To understand the concept of CASE statement.

Pre-requisite Students able to understand the working and use of case statement.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO2: Use of IF, CASE, FOR, LOOP, WHILE and REPEAT control flowstatements.

Solution must contain SQL /PL block with output

Nature of submission Handwritten

References for solvingthe problem

DB2 9 for Linux, UNIX and Windows DBA guide, reference and Exam Prehttp://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. Define case statement.2. State the different forms of case statement.3. Consider above problem 5-a, what change can be made to

give 10% of increment instead of 1000.4. How case statement is different form if statement?

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 20

Practical No: 6 Enrollment No: Group : CPractical Problem Write a SQL/PL code block to calculate area of Parallelogram for a value

of Base varying from 40 to 50.Area = Base × height.Take Height =15.Store the base, height and the calculated area in an empty table namedParallelogram_Area, consisting of three columns Base, Height and area.

Objective(s) To know the use of while statement.

Pre-requisite To understand the looping concept.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO2:Use of IF, CASE, FOR, LOOP, WHILE and REPEAT control flowstatements.

Solution must contain Block using while loop

Nature of submission Handwritten

References for solvingthe problem

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. What is the use of while loop?2. When while loop is terminated?3. What change can be done if we find area of parallelogram

with height varies from 10-20 and fixed base=20?4. Which statement is compulsory for while loop?

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 21

Practical No: 7 Enrollment No: Group : CPractical Problem Consider table : Cricket (PlayerId, PlayerName, Max_score, Country)

Write a block to count Indian players whose maximum scoresLess than 50, 50-100, 100-200, above 200.

Example : display message likeNumber of players whose Max score less than 50 = 2Number of players whose Max score between 50-100 = 4Number of players whose Max score between 100-200 = 5Number of players whose Max score greater than 200 = 2

Objective(s) To know the use of for statement.

Pre-requisite To understand the looping concept.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO2:Use of IF, CASE, FOR, LOOP, WHILE and REPEAT control flowstatements.

Solution must contain Block using for loop

Nature of submission Handwritten

References for solvingthe problem

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. What is the use of for loop?2. What changes can be made in above problem to count all

players instead of Indian player?3. Which data type is used to store record from for loop?4. Which statement is used to terminate for loop?

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 22

Practical No: 1 Enrollment No: Group : DPractical Problem Create the following table:

Emp (E_id, Ename, Salary,City,State,Pincode,Designation,Deptname)Insert at least five records:Perform the queries:

1. Display maximum salary.2. Display employee details having designation is “senior

developer”.3. Display total employee having deptname is “Research”.4. Show employee details having salary greater than 10000 and

designation is “Testing”.5. Display unique state from employee table.

Objective(s) To understand the concept of DBMS.

Pre-requisite To know basic DBMS commands CREATE,SELECT,UPDATE and DELETE

Duration for completion 1 hour

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO1: Differentiate DBMS & RDBMS and use SQL data types.

Solution must contain Query statements with output

Nature of submission Handwritten

References for solvingthe problem

Beginning DB2: From Novice to Professional, Allen G.

http://w3schools.com/Sql/

Post Laboratoryquestions

Post Laboratory questions:1. Write down update statement syntax.2. Using delete statement to remove particular row or column?3. In SELECT command what is meaning of (*)?4. In DB2 which format is used to insert date value in table?

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 23

Practical No: 2 Enrollment No: Group : DPractical Problem Create the following table:

MEDICINE (Medicine_ID, Mname, Type, Manufacturer, Usage, Allergy)STOCK (Stock_no, Batch_no, Medicine_ID, M_Date, Expire_Date, Qty)Make medicine_id of medicine &stock_no of stock table as Primary key.Apply necessary constraints while creating tables.

Medicine_id as foreign key in stock table. Medicinename must not store null value. Allergy must be from “skin”,”vomiting”,”dizziness”and”headache”.

Note: Type – Syrup, Capsule, Tablet, Usage – Headache, fever, High_BP.Insert at least five records in each tables:Perform following queries:

1. Display details about manufactures who manufacture medicines forfever or headache.

2. Display the total quantity available for each medicine.3. Display medicine name and type from medicine table.4. Display medicine name whose expired date greater than “01/11/2015”.5. Delete stock details whose expire date less than “12/11/2013”.

Objective(s) To understand the concept of JOIN and GROUP BY clause.

Pre-requisite To knowledge about joins and GROUP BY clause.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solve industryproblems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessary forsoftware development.

CO(s) to be achieved CO1: Differentiate DBMS & RDBMS and use SQL data types.

Solution must contain Query statements with output

Nature of submission Handwritten

References for solvingthe problem

Beginning DB2: From Novice to Professional, Allen G.

http://w3schools.com/Sql/

Post Laboratoryquestions

Post Laboratory questions:1. What is use of underscore wild card in LIKE operator?2. Can use BETWEEN AND operator with CHAR and VARCHAR data type?3. List out different types of JOIN.4. How to add new attribute in table? Explain with example.

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 24

Practical No: 3 Enrollment No: Group : DPractical Problem 1. Consider Emp table of practical problem-1 of group-D

a. Write a block that accept E_id from user and displaydesignation of that employee.(use concept of anchordatatype)

b. Write a block to insert the user inputted value intoemployee table using row variable.

2. Do as directed.a. Create an array to store designation of 20 employees.b. Write a block that accept 5 designations from the user

and store in above created array and display cardinalityof that array.

Objective(s) To know the syntax of all data types.

Pre-requisite To understand the concept of RDBMS data types.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development

CO(s) to be achieved CO1: Differentiate DBMS & RDBMS and use SQL data types.

Solution must contain Data types statements.

Nature of submission Handwritten

References for solvingthe problem

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. How to drop row data type? Explain with example.2. Row type values and arrays of row type variables can be

passed as parameters to procedures and functions.(True orFalse).

3. Perform q-1(b) without using row variable.4. Consider q-3 (2(b), if I store value from the 10thindex then what

is cardinality of an array?Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 25

Practical No: 4 Enrollment No: Group : DPractical Problem Student(student_id,name,grade)

studentid name grade

1 smith A

2 john B

3 Vishal C

(Note : Accept student id from user)1) Write block that accept student id from user and check grade and printappropriate message.Grade – ‘A’-> ExcellentGrade – ‘B’ -> Very goodGrade – ‘C’ -> GoodGrade – ‘D’ -> AverageGrade- ‘F’ -> Fail2) Write block to find out maximum number from inputted three numberswith validation.

Objective(s) To understand the concept of IF statement.

Pre-requisite Students able to understand the working and use of if statement.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessary forsoftware development.

CO(s) to be achieved CO2: Use of IF, CASE, FOR, LOOP, WHILE and REPEAT control flowstatements.

Solution must contain SQL /PL block with output

Nature of submission Handwritten

References for solvingthe problem

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. What is syntax error occurs when forgot semicolon at END IF

statement?2. What is use of if then else end if statement?3. Solve problem4(2) to find minimum number from inputted data.4. In Boolean expression required comparison operator?

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 26

Practical No: 5 Enrollment No: Group : DPractical Problem Use above student table:

1) Write block that accept student id from user and check grade andprint appropriate message.Grade – ‘A’-> ExcellentGrade – ‘B’ -> Very goodGrade – ‘C’ -> GoodGrade – ‘D’ -> AverageGrade- ‘F’ -> Fail

Objective(s) To understand the concept of CASE statement.

Pre-requisite Students able to understand the working and use of case statement.

Duration for completion 1 hour

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO2: Use of IF, CASE, FOR, LOOP, WHILE and REPEAT control flowstatements.

Solution must contain SQL /PL block with output

Nature of submission Handwritten

References for solvingthe problem

DB2 9 for Linux, UNIX and Windows DBA guide, reference and Exam Pre.http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. Explain search case statement.2. Explain different between simple and search case statement.3. In case statement which clause is used?4. In case statement is required an ELSE statement?

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 27

Practical No: 6 Enrollment No: Group : DPractical Problem Write a SQL/PL code block to calculate the perimeter of circle for a value

of radius varying from 3 to 7.

Store the radius and the corresponding values of calculated perimeter inan empty table named Perimeter, consisting of two columns Radius andperimeter.

Objective(s) To know the use of while statement.

Pre-requisite To understand the looping concept.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO2:Use of IF, CASE, FOR, LOOP, WHILE and REPEAT control flowstatements.

Solution must contain Block using while loop

Nature of submission Handwritten

References for solvingthe problem

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. What is the use of while loop?2. When while loop is terminated?3. What change can be done if we find perimeter of circle from

radius 15 to 20?4. Which statement is compulsory for while loop?

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 28

Practical No: 7 Enrollment No: Group : DPractical Problem Consider table : Mobile_master(ModelNo, ModelName, Price,

Company)

Write a block to count total number of Samsung mobile whose priceLess than 5000, 5000-10000, 10000-20000, above 20000.

Example : display message likeNumber of mobiles whose price less than 5000 = 2Number of mobiles whose price between 5000-10000 = 4Number of mobiles whose price between 10000-20000 = 5Number of mobiles whose price greater than 20000 = 2

Objective(s) To know the use of for statement.

Pre-requisite To understand the looping concept.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO2:Use of IF, CASE, FOR, LOOP, WHILE and REPEAT control flowstatements.

Solution must contain Block using for loop

Nature of submission Handwritten

References for solvingthe problem

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. What is the use of for loop?2. When for loop is terminated?3. Which data type is used to store record from for loop?4. What changes can be made in above problem to maintain

report of all mobile company?Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 29

Practical No: 1 Enrollment No: Group : EPractical Problem Create the following table:

Project_detail(P_id,Pname,Duration,No_of_ emp,Pcost,Staring_date)Insert at least five records:Perform the queries:

1. Display minimum project cost.2. Display project detail whose name first letter is ‘O’.3. Display project name in upper letter.4. Display project detail that is not started.5. Display total project that currently started.

Objective(s) To understand the concept of DBMS

Pre-requisite To know basic DBMS commands CREATE,SELECT,UPDATE and DELETE

Duration for completion 1 hour

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO1: Differentiate DBMS & RDBMS and use SQL data types.

Solution must contain Query statements with output

Nature of submission Handwritten

References for solvingthe problem

Beginning DB2: From Novice to Professional, Allen G.

http://w3schools.com/Sql/

Post Laboratoryquestions

Post Laboratory questions:1. Can space is allowed in table name?2. What command is used to show the structure of table?3. How to find the patent without using LIKE operator?4. Can table name start with digit?

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 30

Practical No: 2 Enrollment No: Group : EPractical Problem Create the following table:

Book (ISBN_NO,Title,Publication,Release_date,Author_id,Price)Author (Author_id,Name,specialization,No_of_book_publish)Apply necessary constraints while creating tables. Make ISBN_NO of book & Author_id of author table as Primary key. Author_id as foreign key in book table. Price must be greater than 0.

Insert at least five records in each tables:Perform following queries:1. Display all possible combination of book and author.

(Note: Use cartesian product)2. Show all books detail whose author name is “William stilling”.

(Note: Do not use join)3. Change the specialization of author_id “Aoo4” to “Data Mining”.4. Display book title of book that mfg date range between “13/12/2010”

to “12/12/2013”.5. Show highest price of book.

Objective(s) To understand the concept of JOIN and GROUP BY clause.

Pre-requisite To knowledge about joins and GROUP by clause.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessary forsoftware development.

CO(s) to be achieved CO1: Differentiate DBMS & RDBMS and use SQL data types.

Solution must contain Query statements with output

Nature of submission Handwritten

References for solvingthe problem

Beginning DB2: From Novice to Professional, Allen G.

http://w3schools.com/Sql/

Post Laboratoryquestions

Post Laboratory questions:1. What is the use of Cartesian product?2. Solved2nd query using join clause.3. Can SELECT is DDL or DML statement?4. List out DDL command.

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 31

Practical No: 3 Enrollment No: Group : EPractical Problem 1. Consider Project _detail table of practical problem-1 of group-E

a. Write a block that accept P_id from user and displayNo_of_emp working on that project. (Use concept ofanchor datatype).

b. Write a block to insert the user inputted value intoProject_detail table using row variable.

2. Do as directed.a. Create an array to store name of 20 projects.b. Write a block that accept 5 project names from the user

and store in above created array and display cardinalityof that array.

Objective(s) To know the syntax of all data types.

Pre-requisite To understand the concept of RDBMS data types.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development

CO(s) to be achieved CO1: Differentiate DBMS & RDBMS and use SQL data types.

Solution must contain Data types statements.

Nature of submission Handwritten

References for solvingthe problem

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. What is the use of associative arrays?2. How simple array differs from associative array?3. Solved q-1(b) without using row variable.4. Consider q-3 (2(b), if I store value from the 13thindex then

what is cardinality of an array?Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 32

Practical No: 4 Enrollment No: Group : EPractical Problem

Create following table:Bank_account( Account_no,Branch_name,Balance)Insert at least five records

1) Write block that will accept an account number from theuser, check if the users balance is less than minimum balance,only then deduct Rs.100/- from the balance.

Note(minimum balance is 5000)2) Write SQL/PL block find out inputted number is odd or even

number.

Objective(s) To understand the concept of IF statement.

Pre-requisite Students able to understand the working and use of case statement.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO2: Use of IF, CASE, FOR, LOOP, WHILE and REPEAT control flowstatements

Solution must contain SQL /PL block with output

Nature of submission Handwritten

References for solvingthe problem

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. In if condition THEN clause is compulsory?2. In End statement semicolon is required or not?3. Write above problem 4(2) to find whether the number is

divisible by 5 or not?4. What type of result is given by Boolean expression?

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 33

Practical No: 5 Enrollment No: Group : EPractical Problem Use above Bank_Account table:

1) Write block that will accept an account number from the user, checkfollowing condition.

a) Deduct Rs.500/- from the balance if the users balance is lessthan Rs.5000.

b) Deduct Rs.300/- from the balanceif the users balance is lessthan Rs.10000.

c) Deduct Rs.100/- from the balance if the users balance is lessthan Rs.20000.

Objective(s) To understand the concept of CASE statement.

Pre-requisite Students able to understand the working and use of case statement.

Duration for completion 1 hour

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO2: Use of IF, CASE, FOR, LOOP, WHILE and REPEAT control flowstatements.

Solution must contain SQL /PL block with output

Nature of submission Handwritten

References for solvingthe problem

DB2 9 for Linux, UNIX and Windows DBA guide, reference and ExamPrep.http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. In case statement which expression is used?2. When no any case statement match then which clause is

executed?3. What changes can be made in problem-5 to deduct 5% of

balance from the balance?4. Explain execution of simple case statement.

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 34

Practical No: 6 Enrollment No: Group : EPractical Problem Write a SQL/PL code block to calculate area of Rectangle for a value of

height varying from 10 to 20.Area = width × height.Take width =10.Store the base, height and the calculated area in an empty table namedRectangle_Area, consisting of three columns Width, Height and area.

Objective(s) To know the use of while statement.

Pre-requisite To understand the looping concept.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO2:Use of IF, CASE, FOR, LOOP, WHILE and REPEAT control flowstatements.

Solution must contain Block using for loop

Nature of submission Handwritten

References for solvingthe problem

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. What is the use of while loop?2. When while loop is terminated?3. What change can be done if we find area of rectangle with

the height varies from 5-10 and width=20?4. Which statement is compulsory for while loop?

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 35

Practical No: 7 Enrollment No: Group :EPractical Problem Consider table : Book_Master(Bid, BookName, Price, Type, Author)

Type should be Educational/OtherWrite a block to count total number of educational books whose priceLess than 500, 500-1000, 1000-2000, above 2000.

Example : display message likeNumber of educational books whose price less than 500 = 5Number of educational books whose price between 500-1000 = 2Number of educational books whose price between 1000-2000 = 4Number of educational books whose price greater than 2000 = 1

Objective(s) To know the use of for statement.

Pre-requisite To understand the looping concept.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO2:Use of IF, CASE, FOR, LOOP, WHILE and REPEAT control flowstatements.

Solution must contain Block using for loop

Nature of submission Handwritten

References for solvingthe problem

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. What is the use of for loop?2. What changes can be made in above problem to maintain

report of all books?3. Which data type is used to store record from for loop?4. Which statement is used to terminate for loop?

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 36

Practical No: 1 Enrollment No: Group : FPractical Problem Create the following table:

Author (Author_id,Name,City,State,Specialization,No_Of_Book_Publish)Insert at least five records:Perform the queries:

1. Show author detail whose publish more than 10 books.2. Display author name whose specialization in “Data Minding”3. Remove author that stay at “Mumbai” city.4. Display total author whose publish more than 10 books.5. Display unique specialization from author table.

Objective(s) To understand the concept of DBMS.

Pre-requisite To know basic DBMS commands CREATE,SELECT,UPDATE and DELETE

Duration for completion 1 hour

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO1: Differentiate DBMS & RDBMS and use SQL data types.

Solution must contain Query statements with output.

Nature of submission Handwritten

References for solvingthe problem

Beginning DB2: From Novice to Professional, Allen G.

http://w3schools.com/Sql/

Post Laboratoryquestions

Post Laboratory questions:1. Why ALTER command is used?2. Can allowed space in attribute name?3. Which command is used to show all table names?4. Can change data type using alter command?

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 37

Practical No: 2 Enrollment No: Group : FPractical Problem Create the following table:

Employee (Emp_id,Ename,City,Contactno,Salary,State,Dept_id)Department (Dept_id,Deptname)Make Emp_id of Employee & Dept_id Department table as Primary key.Apply necessary constraints while creating tables.

Depi_id as foreign key in Employee table. Ename cannot store null value. Salary should be greater than 0. City must be from

“Surat”,”Bardoli”,”Baroda”and”Ahmedabad”.Insert at least five records in each tables:

Perform following queries:1. Change the Empid“E004” to “E008”.2. Display employee detail whose stay at “Surat” and salary

more than 10000.3. Display employee detail whose belong to “Development

department”.4. Show maximum salary from each department.

Objective(s) To understand the concept of JOIN and GROUP BY clause.

Pre-requisite To knowledge about joins and GROUP BY clause.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO1: Differentiate DBMS & RDBMS and use SQL data types.

Solution must contain Query statements with output

Nature of submission Handwritten

References for solvingthe problem

Beginning DB2: From Novice to Professional, Allen G.

http://w3schools.com/Sql/

Post Laboratoryquestions

Post Laboratory questions:1. Which keyword is used to applied foreign key?2. Which command is used to change the table name?3. List out string function.4. Which function is used to find length of string?

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 38

Practical No: 3 Enrollment No: Group : FPractical Problem 1. Consider Author table of practical problem-1 of group-F

a. Write a block that accept Author_id from user and displayNo_of_book_publish by author. (Use concept of anchordatatype).

b. Write a block to insert the user inputted value intoAuthor table using row variable.

2. Do as directed.a. Create an array to store name of 20 books.b. Write a block that accept 5 books name from the user

and store in above created array and display cardinalityof that array.

Objective(s) To know the syntax of all data types.

Pre-requisite To understand the concept of RDBMS data types.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO1: Differentiate DBMS & RDBMS and use SQL data types.

Solution must contain Data types statements.

Nature of submission Handwritten

References for solvingthe problem

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. How to declare variable which is same as Author_id of author

table?2. What are different ways for assigned row value to row

variable?3. Solve q-1(b) without using row variable.4. Consider q-3 (2(b), if I store value from the 7thindex then what

is cardinality of an array?Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 39

Practical No: 4 Enrollment No: Group : FPractical Problem Employee (id, name, sales)

Id Name Sales

1 Smith 50000

2 John 100000

3 Rohan 30000

Create table : Payroll (Empid,bonus)(Note: Accept employee id from user)1) Write SQL/PL blockhaving sales more than 70000 then insert Rs.5000

bonus in payroll table.2) Write SQL/PL block having sales less than 30000 then insert Rs.500

bonuses in payroll table.3) Write SQL/PL block using following condition: If sales more than 80000 then insert bonus Rs.5000 in payroll table. If sales more than 50000 and less than 75000 then insert bonus

Rs.3000 in payroll table. If sales less than 40000 and more than 25000 then insert bonus

Rs.1000 in payroll table. If sales less than 20000 then no bonus applied.

Objective(s) To understand the concept of IF statement.

Pre-requisite Students able to understand the working and use of if statement.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessary forsoftware development.

CO(s) to be achieved CO2: Use of IF, CASE, FOR, LOOP, WHILE and REPEAT control flowstatements.

Solution must contain SQL /PL block with output

Nature of submission Handwritten

References for solvingthe problem

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. When define anchor variable then declare keyword is necessary?2. In if condition can use logical operator?3. Which logical operator use in if statement?4. What changes can be made in problem-4 to insert 10% of bonus

whose sales less than 20000?Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignature

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 40

Date

Practical No: 5 Enrollment No: Group : FPractical Problem Use employee and payroll tables:

1)Write SQL/PL block using following condition(using case statement)

a) If sales more than 80000 then insert bonus Rs.5000 inpayroll table.

b) If sales more than 50000 and less than 75000 then insertbonus Rs.3000 in payroll table.

c) If sales less than 40000 and more than 25000 then insertbonus Rs.1000 in payroll table.

d) If sales less than 20000 then no bonus applied.

Objective(s) To understand the concept of CASE statement.

Pre-requisite Students able to understand the working and use of if statement.

Duration for completion 1 hour

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO2: Use of IF, CASE, FOR, LOOP, WHILE and REPEAT control flowstatements

Solution must contain SQL /PL block with output

Nature of submission Handwritten

References for solvingthe problem

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. What changes can be made in problem-5 to insert 20% of

bonus whose sales less than 90000?2. What is use of return statement?3. In case statement THEN clause is necessary or not?4. In case statement can use Boolean expression?

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 41

Practical No: 6 Enrollment No: Group : FPractical Problem Write a SQL/PL code block to calculate area of Triangle for a value of

height varying from 10 to 20.Area of Triangle= ½ × b × h.Take h=10.Store the base, height and the calculated area in an empty table namedTriangle_Area, consisting of three columns Base, Height and area.

Objective(s) To know the use of while statement.

Pre-requisite To understand the looping concept.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessaryfor software development.

CO(s) to be achieved CO2:

Solution must contain Block using while loop

Nature of submission Handwritten

References for solvingthe problem

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. What is the use of while loop?2. When while loop is terminated?3. What change can be done if we find area of triangle with

height varies from 30-40 and base =30?4. Which statement is compulsory for while loop?

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate

BCA - Semester -2 2014

Ms.Preeti P. Bhatt Page 42

Practical No: 7 Enrollment No: Group :FPractical Problem Consider table : Loan(customerId,customerName, loanType, amount,

No_of_installment)Note: Type should be Home/Educational loanWrite a block to count total number of customer who apply for educationalloan whose loan amountLess than 50000, 50000-100000, 100000-200000, above 200000.

Example : display message likeNumber of customer whose educational loan less than 50000 = 5Number of customer whose educational loan between 50000-100000 = 2Number of customer whose educational loan between 100000-200000 = 4Number of customer whose educational loan greater than 200000 = 1

Objective(s) To know the use of for statement.

Pre-requisite To understand the looping concept.

Duration for completion 2 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solveindustry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessary forsoftware development.

CO(s) to be achieved CO2: Use of IF, CASE, FOR, LOOP, WHILE and REPEAT control flowstatements.

Solution must contain Block using for loop

Nature of submission Handwritten

References for solvingthe problem

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

Post Laboratoryquestions

Post Laboratory questions:1. What is the use of for loop?2. What changes can be made in above problem to maintain report

of all customers instead of those who apply for educational loan?3. Which data type is used to store record from for loop?4. Which statement is used to terminate for loop?

Assessment

Solution achieves the desiredobjective(s)

Viva

Out of Marks 10 5Secured by the studentSignatureDate