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

SQL Python Practicals Class11 Code065

The document contains practical exercises for SQL and Python for Class 11. It includes SQL commands for creating a student table, inserting records, displaying records, applying conditions, sorting data, and counting records. Additionally, it features Python programs for checking even or odd numbers, printing numbers, calculating sums, finding the largest number, and performing basic arithmetic operations.

Uploaded by

Aditya Aryan
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 views4 pages

SQL Python Practicals Class11 Code065

The document contains practical exercises for SQL and Python for Class 11. It includes SQL commands for creating a student table, inserting records, displaying records, applying conditions, sorting data, and counting records. Additionally, it features Python programs for checking even or odd numbers, printing numbers, calculating sums, finding the largest number, and performing basic arithmetic operations.

Uploaded by

Aditya Aryan
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

SQL & Python Practical File – Class 11 (Code 065)

SQL Practicals

SQL Practical 1 – Create Table and Insert Records


Aim: To create a Student table and insert records.

Theory: CREATE TABLE command is used to create a new table and INSERT INTO is used to
add records.

Query:

CREATE TABLE Student(


RollNo INT PRIMARY KEY,
Name VARCHAR(20),
Class VARCHAR(5),
Marks INT);

INSERT INTO Student VALUES


(1,'Riya','11A',85),
(2,'Aman','11A',72),
(3,'Neha','11B',90),
(4,'Karan','11B',65);

SQL Practical 2 – Display All Records


Aim: To display all records from the table.

Theory: SELECT command retrieves data from a table. * represents all columns.

Query:

SELECT * FROM Student;

SQL Practical 3 – Apply WHERE Condition


Aim: To display students having marks greater than 80.

Theory: WHERE clause is used to apply conditions.

Query:

SELECT Name, Marks


FROM Student
WHERE Marks > 80;

SQL Practical 4 – Sort Data


Aim: To display students in descending order of marks.
Theory: ORDER BY sorts records and DESC shows highest to lowest order.

Query:

SELECT * FROM Student


ORDER BY Marks DESC;

SQL Practical 5 – Count Records


Aim: To count total number of students.

Theory: COUNT() is an aggregate function used to count records.

Query:

SELECT COUNT(*) AS Total_Students


FROM Student;
Python Practicals

Python Program 1 – Even or Odd Number


Aim: To check whether a number is even or odd.

Program:

num = int(input("Enter a number: "))

if num % 2 == 0:
print("Even Number")
else:
print("Odd Number")

Python Program 2 – Print Numbers 1 to 10


Aim: To print numbers from 1 to 10 using loop.

Program:

for i in range(1, 11):


print(i)

Python Program 3 – Sum of First N Numbers


Aim: To calculate sum of first N natural numbers.

Program:

n = int(input("Enter value of n: "))


total = 0

for i in range(1, n+1):


total += i

print("Sum =", total)

Python Program 4 – Largest Number


Aim: To find largest among two numbers.

Program:
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))

if a > b:
print("Largest =", a)
else:
print("Largest =", b)

Python Program 5 – Simple Calculator


Aim: To perform basic arithmetic operations.

Program:

a = int(input("Enter first number: "))


b = int(input("Enter second number: "))

print("Addition =", a + b)
print("Subtraction =", a - b)
print("Multiplication =", a * b)
print("Division =", a / b)

You might also like