0% found this document useful (0 votes)
2 views

20 Python Codes_merged (1)

The document contains a collection of 20 Python codes focused on using Pandas and Matplotlib, alongside 15 SQL queries designed to interact with a STUDENTS database table. The SQL queries cover various operations such as selecting records, calculating averages, and filtering data based on conditions. This resource serves as a practical guide for data manipulation and analysis using Python and SQL.

Uploaded by

Utkarsh Jain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

20 Python Codes_merged (1)

The document contains a collection of 20 Python codes focused on using Pandas and Matplotlib, alongside 15 SQL queries designed to interact with a STUDENTS database table. The SQL queries cover various operations such as selecting records, calculating averages, and filtering data based on conditions. This resource serves as a practical guide for data manipulation and analysis using Python and SQL.

Uploaded by

Utkarsh Jain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

{20 Python Codes}

Pandas And Matplotlib














{15 SQL QUERIES}
Selected database table:

Query 1:
Display all records from the STUDENTS table

 SELECT * FROM STUDENTS;

Query 2:
Find students with marks greater than 80;
SELECT Name, Marks FROM STUDENTS WHERE Marks > 80;
Query 3:
List the names of female students

SELECT Name FROM STUDENTS WHERE Gender = 'Female';

Query 4:
Find the average marks of the class

SELECT AVG(Marks) AS Average_Marks FROM STUDENTS;

Query 5:
Count the number of male students

SELECT COUNT(*) AS Male_Students FROM STUDENTS WHERE Gender = 'Male';

Query 6:
Display students in descending order of marks

SELECT * FROM STUDENTS ORDER BY Marks DESC;


Query 7:
Find the youngest student

SELECT Name, Age FROM STUDENTS WHERE Age = (SELECT MIN(Age) FROM STUDENTS);

Query 8:
Display the total marks scored by male students

SELECT SUM(Marks) AS Total_Marks_Males FROM STUDENTS WHERE Gender = 'Male';

Query 9:
Find the maximum marks in the class

SELECT MAX(Marks) AS Highest_Marks FROM STUDENTS;

Query 10:
List students with marks between 70 and 90

SELECT Name, Marks FROM STUDENTS WHERE Marks BETWEEN 70 AND 90;
Query 11:
Find the total number of students

SELECT COUNT(*) AS Total_Students FROM STUDENTS;

Query 12:
Group students by gender and find the average marks

SELECT Gender, AVG(Marks) AS Average_Marks FROM STUDENTS GROUP BY Gender;

Query 13:
Display the names of students whose names start with 'A'

SELECT Name FROM STUDENTS WHERE Name LIKE 'A%';

Query 14:
Find students who failed (Marks < 70)

SELECT Name, Marks FROM STUDENTS WHERE Marks < 70;


Query 15:
Find the number of students in each age group

SELECT Age, COUNT(*) AS Student_Count FROM STUDENTS GROUP BY Age;

You might also like