12 CS24-25 Practical file
12 CS24-25 Practical file
S Topic Pa Da Si
r ge te gn
No
N
.
o.
PYTHON PROGRAMS
1. Program to print a square multiplication table from 1 to
10
MySQL Programs
1. Create table Employee having EmpID, Name, Gender,
DOB with EmpID as
Primary key.
Null values.
Customer.
Customer.
Write SQL queries for (a) to (d) and the output of SQL
commands for (e) to (h):
TABLE WATCHES
TABLE SALE
SUM(Qty_Sold),
GROUP BY S.WATCHID;
4. Create the following tables for the database Library:
Table : BOOKS
Table : ISSUED
Publishers=”EBP”;
TABLE DEPT
TABLE WORKER
Wno.
29 28.10.22
WHERE
MySQL.
Code:-
Output:-
Program 2: Program to check whether the given character is alphabet or
digit
Code:-
Output:-
Program 3: Program that reads a string and checks whether it is
palindrome or not
Code:-
Output:-
Program 4: Define two variables first and second so that first = ‘jimmy’
and second=’johny’. Write a short python code segment that swaps the
values assigned to these two variables and prints the results.
Code:-
Output:-
Code:-
Output:-
Code:-
Output:-
Code:-
Output:-
Program 8: Program to read a text file line by line and display each word
separated by a #
Code:-
Output:-
Text file:
Output:
Text document-
Program 10: .Program to remove all the lines that contain the character 'a'
in a file and write it to another file
Code:-
Output:-
Text file:-
Program 11: Program to create a binary file with name and roll number.
Search for a given roll number and display the name, if not found display
appropriate message
Code:-
Output:-
Program 12: Create a binary file with roll number, name and marks. Input
a roll number and update the marks
Code:
Output:
Program 13: .Write a function to count the number of lines in a text file
“My_Story.txt” that are starting with an alphabet “A”
Code:
Output:
Text File:
Code:-
Output:-
Code:
Output:
Code:-
Output :-
MySQL
PROGRAM
S
Program 1) Create table Employee having EmpID, Name, Gender, DOB with EmpID as Primary key.
c. Change the data type of the field Emp_Address to varchar(50) and allow Null values.
Code:
Program 2) Create table Customer as per following Table Instance Chart
a. Add one column Email of data type VARCHAR and size 30 to the table Customer.
b. Add one column Email of data type VARCHAR and size 30 to the table Customer.
Code:
Table Watches:
Table Sale:
a. Display all the details of those watches whose name end with “Time”
b. Display the name and price of those watches, which have a price range in between 5000 –
15000. c. Display the total quantity in store of ‘Unisex’ type watches.
d. Display the watch names and the quantity sold in the first quarter.
Code:
Program 4) Create the following tables for the database Library
Table Books:
Table Issued:
a. To show Book name, Author name and Price of books of First Publ. publishers.
c. To display the names and price from books in ascending order of their price.
e. To display the Book_Id, Book_Name, and Quantity_Issued for all books which have been
issued.(The query will require contents from both the tables.)
f. To insert a new row in the table Issued having the following data: “F003”, 1
g. Give the output of the following queries based on the above tables:
(i). To display Wno, Name, Gender from table WORKER in descending order of Wno.
(ii). To display the Name of all the FEMALE workers from the table WORKER.
(iii). To display the Wno and Name of those workers from the table WORKER who are born
between ‘1987-01-01’ and ‘1991-12-01’.
(iv). To count and display MALE workers who have joined after ‘1986-01-01’.
(v). SELECT COUNT(*), DCODE FROM WORKER GORUP BY DCODE HAVING COUNT(*)>1;
(vii). SELECT NAME, DEPARTMENT, CITY FROM WORKER W, DEPT D WHERE W.DCODE =
D.DCODE AND WNO<1003;
Code:
No error indicates successful execution!
Output:
Program 2: Write a program for creating database student table using Interface Python with MySQL
Code:
Program 3: Write a program to insert 10 records in the above table and display the same
Code:
Output:
Code:
Output: