0% found this document useful (0 votes)
9 views12 pages

Cs Practical Sample Programs

The document is a lab manual for Computer Science (083) at Sishya School, Hosur, detailing Python and SQL programs. It includes tasks such as reading files, implementing stack operations, and executing SQL commands for creating and manipulating tables. Each section provides program requirements, sample outputs, and SQL queries based on specific tables.

Uploaded by

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

Cs Practical Sample Programs

The document is a lab manual for Computer Science (083) at Sishya School, Hosur, detailing Python and SQL programs. It includes tasks such as reading files, implementing stack operations, and executing SQL commands for creating and manipulating tables. Each section provides program requirements, sample outputs, and SQL queries based on specific tables.

Uploaded by

getyourinfo97
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SISHYA SCHOOL, HOSUR

LAB MANUAL
COMPUTER SCIENCE (083)
PYTHON PROGRAMS
1. Develop a python program to read a text file line by line and display each word separated
by #.

OUTPUT
2. Develop a python 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.
PROGRAM
OUTPUT
3. Develop a python program to implement a PUSH () and POP () operations of a stack
using a list data structure.
PROGRAM
OUTPUT
4. Develop a python program to perform read and write operation onto a “[Link]” file
having fields as roll number, name stream and percentage.

PROGRAM

OUTPUT
MYSQL PROGRAMS

1. Write the SQL commands for (i) to (iii) and write the output of the (iv) on the basis of table
Employee.

Relation : Employee
ENo. Name Age Department Dateofadm Salary Sex
1 Jugal 34 Computer 10/01/97 12000 M
2 Sharmila 31 History 24/03/98 20000 F
3 Sandeep 32 Maths 12/12/96 30000 M
4 Sangeeta 35 History 01/07/99 40000 F
5 Rakesh 42 Maths 05/09/97 25000 M

i To create a table employee.


ii To insert the given 5 records.
iii To display the names of all employees whose department is neither
‘computer’ nor ‘history’.
iv Give the output of the following SQL statement.
Select COUNT(distinct Department) from Employee;

I. CREATE TABLE EMPLOYEE (ENO INT,NAME VARCHAR(25),AGE INT,DEPARTMENT


VARCHAR(25), DATEOFADM DATE, SALARY INT,SEX CHAR(1));
II. INSERT INTO EMPLOYEE VALUES
(1,”JUGAL”,34,”COMPUTER”,”10/01/97”,12000,”M”);
III. SELECT NAME FROM EMPLOYEE WHERE DEPARTMENT NOT IN
(“COMPUTER”,”HISTORY”);
IV.

COUNT(DISTINCT(DEPATMENT))
3
2.

Write the SQL commands for (i) to (iii) and write the output of the (iv) on the basis
of table FRESH.

i To create a table FRESH


ii To insert the above records into the table.
iii To display all the values of the table where the itemname has at least one
character “o”.
iv Give the output of the following SQL statement.
SELECT ITEMNAME FROM FRESH WHERE SCODE>11 AND QTY<20;

I. CREATE TABLE FRESH (ITEMCODE INT,ITEMNAME VARCHAR(30),SCODE INT,


QTY INT);
II. INSERT INTO FRESH VALUES (1001,”POTATO”,11,50);
III. SELECT * FROM FRESH WHERE ITEMNAME LIKE “%O%”;

IV.

ITEMNAME
NONE
3.

Write the SQL commands for (i) to (iv) on the basis of table STUDENT

i To create a table student


ii To insert all the records shown in the table.
iii To display the names of all students who belongs to class XII and their
STREAMID is greater than 10.
iv To sort the given table in ascending order of the student name.

i. CREATE TABLE STUDENT (ADMNO INT, NAME VARCHAR(25),CLASS


VARCHAR(20),SEC CHAR (1), STREAM ID INT);
ii. INSERT INTO STUDENT VALUES (1101,”NAVEEN”,”XII”,”A”,10);
iii. SELECT NAME FROM STUDENT WHERE CLASS=”XII” AND STREAMID>10;
iv. SELECT * FROM STUDENT ORDERBY NAME;
4.

Write the SQL commands for (i) to (iv) on the basis of table ACCESSORIES

i To create a table accessories.


ii To insert the given records into the table
iii To display the name and price of all the accessories whose price is less
than 4000.
iv To display the price of the product whose id is either “S001” or “S003”.

i. CREATE TABLE ACCESSORIES (NO VARCHAR(30),NAME


VARCHAR(30),PRICE INT,ID VARCHAR(30));
ii. INSERT INTO ACCESSORIES VALUES (“A01”,”MOTHER
BOARD”,12000,”S001”);
iii. SELECT NAME,PRICE FROM ACCESSORIES WHERE PRICE <4000;
iv. SELECT PRICE FROM ACCESSORIES WHERE ID=”S001” OR ID = “S003”;

You might also like