RELATIONAL DATABASE AND
MY SQL. . .
Quest:1
Consider the tables “hotel”.
1) Mr. Vinayak wants to find the average salary of each category what should
he write?
HOTEL!
sol(1)
select category, avg(salary) from hotel group by category
=========================================
pg. 1
Quest:2
Consider the tables “product”, “client”.
1) Display details of all clients whose city is delhi.
2) Display details of those whose price range of 50 to 100.
3) Display details pf those product whose name ends with ‘wash’.
PRODUCT!
CLIENT!
pg. 2
sol(1)
Select * from client where city=”delhi”;
sol(2)
Select * from product where price between 50 and 100;
sol(3)
Select * from product where ProductName like ‘%Wash’;
=========================================
Quest:3
pg. 3
Consider the tables “carden”.
1) Display names of all the silver colored car.
2) Display name, make, capacity of cars in descending order by sitting capacity.
3) Display the highest charge at which a vehicle can be hired from carden.
CARDEN!
sol(1)
Select carname fo=rom carden where color=’silver’;
sol(2)
Select carname,make,capacity from carden order by capacity desc;
pg. 4
sol(3)
Select max(charges) from carden;
=========================================
Quest:4
Consider the tables“account”,“branch”.
1) What will be the output of ‘select * from account natural join branch’.
account!
BANK!
pg. 5
sol(1)
=========================================
Quest:5
Considering the tables “ORDERS”.
1) Display Pname, Quantity, rate for orders that are pencil or pen.
2) Display orders which are not getting any discount.
3) Display orders whose rate range is between 20 to 100.
4) Display Pname, Quantity, Sale_date for orders whose Quantity*rate is >500.
ORDERS!
sol(1)
Select Pname,Quantity,rate from orders where pname like(‘pen%’);
pg. 6
sol(2)
Select * from orders where discount is null;
sol(3)
Select pname,quantity,saledate from orders where quantity*rate>500;
=========================================
Quest:6
Considering the tables “sports”.
1) Display names of student who has c grade in game1 or 2 or both.
2) Display numbers of student getting grade A in cricket.
3) Display game taken up by students whose name starts with A.
4) Add a new column named marks.
pg. 7
sol(1)
Select name from sports where grade1=’c’ or grade2=’c’;
sol(2)
Select count(*) as ‘number of students’ from sports where game1=’cricket’ and
grade1=’A’ or game2=’cricket’ and grade2=’A’;
sol(3)
Select game1,game2 from sports where name like ‘A%’;
pg. 8
sol(4)
alter table sports add(marks INT(4));
=========================================
Quest:7
Considering the tables “employee”,”sal”.
1) Display details of all employee in descending order of date of joining.
2) Display name and designation of employees whose salary grade is either S02
or S03.
3) Display all details of employee who joins between 9 feb 2006 and 8 aug 2009.
EMPLOYEE!
SAL!
pg. 9
sol(1)
Select * from employee order by doj desc;
sol(2)
Select name,desig from employee where sgrade=’S02’or sgrade=’S03’;
sol(3)
Select * from employee where doj between ‘2006-02-09’ and ‘2009-08-02’;
=========================================
Quest:8
pg. 10
Considering the tables “furniture”
1) Display the price of babycot
2) List details of furniture whose price is more than 10000.
FURNITURE!
sol(1)
Select price from furniture where type=’babycot’;
sol(2)
select * from furniture where price>’10000’;
pg. 11
=========================================
Quest:9
Considering the tables “loan”
1) Display the sum of all the loan amounts whose interest rate is greater than
10.
2) Display the maximum loan interest from loan tables.
3) Display the count of all loan holders whose intrest rate is null.
sol(1)
Select some from (loan_amount)from loan where int_rate>10;
sol(2)
select max(interest)FROM loan;
pg. 12
sol(3)
select count(*) from loan where int_rate is null
=========================================
Quest:10
Considering the tables “sports”.
1) Display names of student who has c grade in game1 or 2 or both.
2) Display numbers of student getting grade A in cricket.
3) Display game taken up by students whose name starts with A.
sol(1)
Select name from sports where grade1=’c’ or grade2=’c’;
pg. 13
sol(2)
Select count(*) as ‘number of students’ from sports where game1=’cricket’ and
grade1=’A’ or game2=’cricket’ and grade2=’A’;
Sol(3)
Select game1,game2 from sports where name like ‘A%’;
pg. 14
PYTHON BASICS. . .
Quest:1
Write a program that reads a line and prints its frequency chart like no. of
uppercase letters, no. of lowercase letters, no. of digits.
Quest:2
Write a program to find the second largest element in a list “Num”.
pg. 15
pg. 16
Quest:3
Write a program to read a list of elements. Input an element from the user that
has to be inserted in the list. Also, input the position at which it is to be inserted.
Apply a built-in function to insert the element at the desired position in the list.
Quest:4
Write a program to read a list of elements. Modify this list so that it does not
contain any duplicate elements i.e., all elements occurring multiple times in the
list should be deleted and only their first occurrences should be displayed in the
final list.
pg. 17
Quest:5
Write an interactive program to create an integer list of 8 integers and sort the
list in ascending order using bubble sort method.
pg. 18
pg. 19
Quest:6
Write a python program to shift each element of a list to the right so that the last
element becomes the first element. For example, the given list
pg. 20
Quest:7
Write a Python code to store ‘n’ number of subjects in a tuple.
pg. 21
Quest:8
Write a program to print all the elements of a tuple in the reverse order.
Quest:9
Write a program to input n numbers from the user, store these numbers in a
tuple and print the maximum, minimum number along with the sum and mean of
all the elements from this tuple.
pg. 22
Quest:10
Write a Python program to input any two tuples and swap their values.
pg. 23
Quest:11
Write a program to input total number of sections and stream name in
11th class and display all information on the output screen.
pg. 24
Quest:12
WAP to store students’ information like admission number, name and
marks in a dictionary and display information on the basis of admission
number.
pg. 25
pg. 26
Quest:13
Write a program to enter names of employees and their salaries as input
and store them in a dictionary.
pg. 27
Quest:14
Write a program to count the number of times a character appears in a
given string using a dictionary.
Quest:15
Program to find the sum of the series: ▪ s = 1+x2+x3+x4…+xn
pg. 28
Quest:16
Illustrating the working of break statement.
Quest:17
Write a python script to calculate the sum of the following series:
pg. 29
S = (1)+(1+2)+(1+2+3)+……+(1+2+3+….+n)
Quest:18
To calculate and display the factorial of an inputted number.
pg. 30
pg. 31
DATA FILE HANDLING. . .
Implementation:1
Input-
Output-
File-
=========================================
Implementation:2
Input-
pg. 32
Output-
File-
=========================================
Implementation:3
Input-
Output-
File-
pg. 33
=========================================
Implementation:4
Input-
Output-
File-
=========================================
Implementation:5
Input-
pg. 34
Output-
File-
=========================================
Implementation:6
Input-
Output-
File-
pg. 35
=========================================
Implementation:7
Input-
Output-
File-
=========================================
Implementation:8
Input-
pg. 36
Output-
File-
=========================================
Implementation:9
Input-
Output-
File-
pg. 37
=========================================
Implementation:10
Input-
Output-
File-
=========================================
Implementation:11
Input-
pg. 38
Output-
File-
=========================================
Implementation:12
Input-
Output-
File-
pg. 39
=========================================
Implementation:13
Input-
Output-
File-
=========================================
Implementation:14
Input-
pg. 40
Output-
File-
=========================================
Implementation:15
Input-
pg. 41
File_record-
File (test9)-
=========================================
Implementation:16
Input-
Output-
File-
pg. 42
=========================================
Implementation:17
Input-
Output-
File-
=========================================
Implementation:18
Input-
pg. 43
Output-
File-
=========================================
Implementation:19
Input-
Output-
pg. 44
File-
=========================================
Implementation:20
Input-
pg. 45
Output-
File-
=========================================
Implementation:21
Input-
Output-
pg. 46
File-
pg. 47
=========================================
Implementation:22
Input-
pg. 48
Output-
pg. 49
File-
=========================================
Implementation:23
Input-
pg. 50
Output-
File-
=========================================
Implementation:24
Input-
Output-
File-
pg. 51
=========================================
Implementation:25
Input-
Output-
File-
=========================================
Implementation:26
Input-
pg. 52
Output-
File-
=========================================
Implementation:27
Input-
Output-
pg. 53
File-
=========================================
Implementation:28
Input-
Output-
File-
=========================================
pg. 54
Implementation:29
Input-
Output-
File-
=========================================
Implementation:30
Input-
pg. 55
Output-
File-
pg. 56
FUNCTIONS. . .
Quest:1
Write a program to add and subtract 2 values inputted and give the results.
Input-
Output-
=========================================
Quest:2
Modify of program 2 to comute the basic calculations performed in a
calculator.
Input-
pg. 57
Output-
=========================================
Quest:3
Modify of program 2 to comute the basic calculations performed in a
calculator.
Input-
Input-
=========================================
Quest:4
Generate table for a inputted no.
Input-
pg. 58
Output-
=========================================
Quest:5
Calculate avg of 4 no. inputted and display.
Input
Output-
pg. 59
=========================================
Quest:6
Count the no. of characters in given string
Input-
Output-
=========================================
Quest:7
Generate random number from 0 to 29.
Input-
Output-
pg. 60
=========================================
Quest:8
Display total no. of vowels in inputted string.
Input-
Output-
=========================================
Quest:9
Calculate power of a number inputted
Input-
pg. 61
Output-
=========================================
Quest:10
Pass student record as a dictionary and update their marks
Input-
Output-
pg. 62
DATA STRUCTURES
IN_PYTHON...
Quest:1
Python program to implement all basic operations of stack such as push,pop and
traverse using lists.
Input-
Output-
pg. 63
=========================================
Quest:2
Python program to display unique vowels in the given word using stack .
Input-
Output-
=========================================
Quest:3
Write a program to create a stack called Employee, to perform the basic
operations on stack using list. The list contains the two values—employee
number and employee name. the program should include the options for
addition, deletion and display of employee details.
Input-
pg. 64
Output-
pg. 65
pg. 66