0% found this document useful (0 votes)
3 views26 pages

ppyy

Uploaded by

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

ppyy

Uploaded by

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

EX.

NO: 9

DATE:

CREATING PYTHON PROGRAM TO DISPLAY SHORT WORDS FROM A


TEXT FILE

AIM:

To Write a method Disp() in Python, to read the lines from poem.txt and
display those

words which are less than 5 characters.

Result:

Thus, the above Python program has been executed and the output is
verified successfully

EX.NO: 10
DATE:
CREATING A PYTHON PROGRAM TO COPY PARTICULAR LINES OF A
TEXT FILE
INTO AN ANOTHER TEXT FILE
AIM:
To write a python program to read lines from a text file "Sample.txt"
and copy those lines
into another file which are starting with an alphabet 'a' or 'A'
Result:
Thus, the above Python program has been executed and the output is
verified
successfully.

Python Executed Program Output:

New.txt:

EX.NO: 11
DATE:
CREATING A PYTHON PROGRAM TO CREATE AND SEARCH RECORDS IN
BINARY FILE
AIM:
To write a Python Program to Create a binary file with roll number and
name.
Search for a given roll number and display the name, if not found
display appropriate
message.
Result:
Thus, the above Python program has been executed and the output is
verified
successfully.

EX.NO: 12
DATE:
CREATING A PYTHON PROGRAM TO CREATE AND UPDATE/MODIFY
RECORDS IN
BINARY FILE
AIM:
To write a Python Program to Create a binary file with roll number,
name, mark
and update/modify the mark for a given roll number.
Result:
Thus, the above Python program has been executed and the output is
verified
successfully.

EX.NO: 13
DATE:
CREATING A PYTHON PROGRAM TO CREATE AND SEARCH EMPLOYEE’S
RECORD
IN CSV FILE.
AIM:
To write a Python program Create a CSV file to store Empno, Name,
Salary and search any Empno
and display Name, Salary and if not found display appropriate message.
Result:
Thus, the above Python program has been executed and the output is
verified
successfully

EX.NO: 14
DATE:
AIM:
CREATING A PYTHON PROGRAM TO IMPLEMENT STACK
OPERATIONS(LIST)
To write a Python program to implement Stack using a list data-
structure, to perform
the following operations:
(i) To Push an object containing Doc_ID and Doc_name of doctors who
specialize
in "ENT" to the stack.
(ii) (ii) To Pop the objects from the stack and display them.
(iii)
(iv) (iii) To display the elements of the stack (after performing PUSH or
POP)
Result:
Thus, the above Python program has been executed and the output is
verified
successfully.
EX.NO: 15
DATE:
CREATING A PYTHON PROGRAM TO IMPLEMENT STACK
OPERATIONS(Dictionary)
AIM:
To Write a program, with separate user-defined functions to perform
the following
operations:
(i) To Create a function Push(Stk,D) Where Stack is an empty list and D is
Dictionary of Items.
from this Dictionary Push the keys (name of the student) into a stack,
where
the corresponding value (marks) is greater than 70.
(ii) To Create a Function Pop(Stk) , where Stk is a Stack implemented by
a list of student
names. The function returns the items deleted from the stack.
(iii) To display the elements of the stack (after performing PUSH or
POP).
Result:
Thus, the above Python program has been executed and the output is
verified
successfully
EX.NO: 16
DATE:
CREATING A PYTHON PROGRAM TO INTEGRATE MYSQL WITH PYTHON
(CREATING DATABASE AND TABLE)
AIM:
To write a Python Program to integrate MYSQL with Python to create
Database and Table
to store the details of employees.
Result:
Thus, the above Python program has been executed and the output is
verified
successfully.

EX.NO: 17
DATE:
AIM:
CREATING A PYTHON PROGRAM TO INTEGRATE MYSQL WITH PYTHON
(INSERTING RECORDS AND DISPLAYING RECORDS)
To write a Python Program to integrate MYSQL with Python by inserting
records to
Emp table and display the records.
Result:
Thus, the above Python program has been executed and the output is
verified
successfully.
EX.NO: 18
DATE:
AIM:
CREATING A PYTHON PROGRAM TO INTEGRATE MYSQL WITH PYTHON
(SEARCHING AND DISPLAYING RECORDS)
To write a Python Program to integrate MYSQL with Python to search an
Employee using
EMPID and display the record if present in already existing table EMP, if
not display the
appropriate message.
Result:
Thus, the above Python program has been executed and the output is
verified
successfully

EX.NO: 19
DATE:
AIM:
CREATING A PYTHON PROGRAM TO INTEGRATE MYSQL WITH PYTHON
(UPDATING RECORDS)
To write a Python Program to integrate MYSQL with Python to search an
Employee using
EMPID and update the Salary of an employee if present in already
existing table
EMP, if not display the appropriate message.
Result:
Thus, the above Python program has been executed and the output is
verified
successfully.

SQL COMMANDS EXERCISE - 1


Ex.No: 20
DATE:
AIM:
To write Queries for the following Questions based on the given table:
(C) Write a Query to create the above table called: "STU"
CREATE TABLE STU(ROLLNO INT PRIMARY KEY,NAME VARCHAR(10),
GENDER VARCHAR(3), AGE INT,DEPT VARCHAR(15),
DOA DATE,FEES INT);

(D) Write a Query to list all the existing database names.


SHOW DATABASES;
(E) Write a Query to List all the tables that exists in the current
database.
SHOW TABLES;
Output:

SQL COMMANDS EXERCISE - 2


Ex.No: 21
DATE:
AIM:
To write Queries for the following Questions based on the given table:
(A) Write a Query to insert all the rows of above table into Info table.
INSERT INTO STU VALUES (1,'Arun','M', 24,'COMPUTER','1997-01-10',
120);
INSERT INTO STU VALUES (2,'Ankit','M', 21,'HISTORY','1998-03-24',
200);
INSERT INTO STU VALUES (3,'Anu','F', 20,'HINDI','1996-12-12', 300);
INSERT INTO STU VALUES (4,'Bala','M', 19, NULL,'1999-07-01', 400);
INSERT INTO STU VALUES (5,'Charan','M', 18,'HINDI','1997-06-27',
250);
INSERT INTO STU VALUES (6,'Deepa','F', 19,'HISTORY','1997-06-27',
300);
INSERT INTO STU VALUES (7,'Dinesh','M', 22,'COMPUTER','1997-02-
25', 210);
INSERT INTO STU VALUES (8,'Usha','F', 23, NULL,'1997-07-31', 200);
(B) Write a Query to display all the details of the Employees from the
above table 'STU'.
SELECT * FROM STU;

(C) Write a query to Rollno, Name and Department of the students


from STU table.
SELECT ROLLNO,NAME,DEPT FROM STU;
(D) Write a Query to select distinct Department from STU table.
SELECT DISTICT(DEPT) FROM STU;

(E) To show all information about students of History department.


SELECT * FROM STU WHERE DEPT='HISTORY';
Ex.No: 22
SQL COMMANDS EXERCISE - 3
DATE:
AIM:
To write Queries for the following Questions based on the given table:

(A) Write a Query to list name of female students in Hindi


Department.
SELECT NAME FROM STU WHERE DEPT='HINDI' AND GENDER='F';

(B) Write a Query to list name of the students whose ages are
between 18 to 20.
SELECT NAME FROM STU WHERE AGE BETWEEN 18 AND 20;

(C) Write a Query to display the name of the students whose name is
starting with 'A'.
SELECT NAME FROM STU WHERE NAME LIKE 'A%';
(d) Write a query to list the names of those students whose name
have second alphabet 'n' in their
names.
SELECT NAME FROM STU WHERE NAME LIKE '_N%';

Ex.No: 23
SQL COMMANDS EXERCISE - 4
DATE:
AIM:
To write Queries for the following Questions based on the given table:

(A) Write a Query to delete the details of Roll number is 8.


DELETE FROM STU WHERE ROLLNO=8;
'

(B) Write a Query to change the fess of Student to 170 whose Roll
number is 1, if the existing fess
is less than 130.
UPDATE STU SET FEES=170 WHERE ROLLNO=1 AND FEES<130;

(C) Write a Query to add a new column Area of type varchar in table
STU.
ALTER TABLE STU ADD AREA VARCHAR(20);
(D) Write a Query to Display Name of all students whose Area
Contains NULL.
SELECT NAME FROM STU WHERE AREA IS NULL;

(E) Write a Query to delete Area Column from the table STU.
ALTER TABLE STU DROP AREA;

(F) Write a Query to delete table from Database.


DROP TABLE STU;
Ex.No: 24
SQL COMMANDS EXERCISE - 5
DATE:
AIM:
To write Queries for the following Questions based on the given table:

(A) To Display the average price of all the Uniform of Raymond


Company from table COST.

SELECT AVG(PRICE) FROM COST WHERE COMPANY='RAYMOND';

(B) To display details of all the Uniform in the Uniform table in


descending order of Stock date.
SELECT * FROM UNIFORM ORDER BY STOCKDATE DESC;
(C) To Display max price and min price of each company.
SELECT COMPANY,MAX(PRICE),MIN(PRICE) FROM COST GROUP BY
COMPANY;

(D) To display the company where the number of uniforms size is


more than 2.
SELECT COMPANY, COUNT(*) FROM COST GROUP BY COMPANY
HAVING COUNT(*)>2;
(E) To display the Ucode, Uname, Ucolor, Size and Company of tables
uniform and cost.

SELECT U.UCODE,UNAME,UCOLOR,SIZE,COMPANY FROM UNIFORM


U,COST C WHERE
U.UCODE=C.UCODE;

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