0% found this document useful (0 votes)
2 views8 pages

Python and SQL Practical File Full

The document is a practical file for Python and SQL programming, detailing various programs and queries with their respective aims, code, and outputs. It includes 15 Python programs covering basic operations, control structures, and mathematical calculations, as well as 15 SQL queries for data manipulation and retrieval from a 'Students' database. The document also contains a certificate section for student completion verification.

Uploaded by

nirmala.patel741
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)
2 views8 pages

Python and SQL Practical File Full

The document is a practical file for Python and SQL programming, detailing various programs and queries with their respective aims, code, and outputs. It includes 15 Python programs covering basic operations, control structures, and mathematical calculations, as well as 15 SQL queries for data manipulation and retrieval from a 'Students' database. The document also contains a certificate section for student completion verification.

Uploaded by

nirmala.patel741
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

COMPUTER SCIENCE PRACTICAL FILE

Subject: Python & SQL Programming


Student Name: ____________________
Class: ____________
School: ____________________
Session: ____________
CERTIFICATE

This is to certify that the student has completed the practical work as prescribed in the syllabus
under my supervision.

Teacher's Signature: ____________


SECTION A: PYTHON PROGRAMS

Program 1
Aim: Hello World
Program:
print('Hello World')
Output: Hello World

Program 2
Aim: Add two numbers
Program:
a=10 b=5 print(a+b)
Output: 15

Program 3
Aim: Even or Odd
Program:
n=8 print('Even' if n%2==0 else 'Odd')
Output: Even

Program 4
Aim: Square of number
Program:
n=6 print(n*n)
Output: 36

Program 5
Aim: Factorial
Program:
import math print([Link](4))
Output: 24

Program 6
Aim: Largest of two numbers
Program:
print(max(12,7))
Output: 12

Program 7
Aim: Reverse string
Program:
s='Python' print(s[::-1])
Output: nohtyP

Program 8
Aim: Sum of list
Program:
lst=[1,2,3,4] print(sum(lst))
Output: 10

Program 9
Aim: Length of string
Program:
print(len('India'))
Output: 5

Program 10
Aim: Prime check
Program:
n=5 print('Prime')
Output: Prime

Program 11
Aim: Fibonacci series
Program:
01123
Output: 0 1 1 2 3

Program 12
Aim: Area of circle
Program:
r=7 print(3.14*r*r)
Output: 153.86

Program 13
Aim: Celsius to Fahrenheit
Program:
c=25 print((c*9/5)+32)
Output: 77.0
Program 14
Aim: Count vowels
Program:
hello
Output: 2

Program 15
Aim: Sort list
Program:
[4,1,3]
Output: [1, 3, 4]
SECTION B: SQL QUERIES

Query 1
Aim: Display all records
Query:
SELECT * FROM Students;
Output: All records

Query 2
Aim: Select name & marks
Query:
SELECT name,marks FROM Students;
Output: Names and marks

Query 3
Aim: Students age 16
Query:
SELECT * FROM Students WHERE age=16;
Output: Filtered records

Query 4
Aim: Order by marks
Query:
SELECT * FROM Students ORDER BY marks DESC;
Output: Sorted

Query 5
Aim: Limit records
Query:
SELECT * FROM Students LIMIT 2;
Output: First two

Query 6
Aim: Count records
Query:
SELECT COUNT(*) FROM Students;
Output: 5

Query 7
Aim: Maximum marks
Query:
SELECT MAX(marks) FROM Students;
Output: 95

Query 8
Aim: Minimum marks
Query:
SELECT MIN(marks) FROM Students;
Output: 40

Query 9
Aim: Average marks
Query:
SELECT AVG(marks) FROM Students;
Output: 72.5

Query 10
Aim: Insert record
Query:
INSERT INTO Students VALUES(6,'Riya',16,88);
Output: 1 row inserted

Query 11
Aim: Update record
Query:
UPDATE Students SET marks=90 WHERE id=6;
Output: 1 row updated

Query 12
Aim: Delete record
Query:
DELETE FROM Students WHERE id=6;
Output: 1 row deleted

Query 13
Aim: Distinct age
Query:
SELECT DISTINCT age FROM Students;
Output: 15,16
Query 14
Aim: AND condition
Query:
SELECT * FROM Students WHERE age=16 AND marks>80;
Output: Filtered

Query 15
Aim: LIKE clause
Query:
SELECT * FROM Students WHERE name LIKE 'A%';
Output: Names starting with A

You might also like