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

SQL Queries

The document outlines various SQL queries for managing student data, including single table queries on the 'Students' table and multiple table queries involving 'Courses' and 'Enrollments'. It also mentions Python-SQL connectivity tasks such as creating databases, adding data, and retrieving information about students and their enrolled courses. The focus is on querying student information based on specific criteria and analyzing enrollment data.

Uploaded by

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

SQL Queries

The document outlines various SQL queries for managing student data, including single table queries on the 'Students' table and multiple table queries involving 'Courses' and 'Enrollments'. It also mentions Python-SQL connectivity tasks such as creating databases, adding data, and retrieving information about students and their enrolled courses. The focus is on querying student information based on specific criteria and analyzing enrollment data.

Uploaded by

beastboylove bbl
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

SQL Queries:

1. Single Table Queries (Using One Table - Students)

 SELECT * FROM Students;

 SELECT Name, Marks FROM Students;

 SELECT * FROM Students WHERE Marks > 80;


 SELECT COUNT(*) AS TotalStudents FROM
Students;

 SELECT * FROM Students WHERE City = 'Delhi';

 SELECT Name,Marks FROM Students ORDER BY


Marks DESC
2. Multiple Table Queries (Using Two more Table –
Courses and Enrollments)

SELECT Students.Name, Courses.CourseName FROM Students

JOIN Enrollments ON Students.RollNo = Enrollments.RollNo

JOIN Courses ON Enrollments.CourseID = Courses.CourseID;

SELECT Students.Name FROM Students

JOIN Enrollments ON Students.RollNo = Enrollments.RollNo

JOIN Courses ON Enrollments.CourseID = Courses.CourseID

WHERE Courses.CourseName = 'Physics';


PYTHON-SQL Connectivity:
1. Creating Multiple Databases :
2.Adding data in these Databases:
3. Python Program to Retrieve All Students with Their
Enrolled Courses
4. Python Program to Find the Total Number of
Students Enrolled in Each Course
5. Python Program to Retrieve Students with Marks
Greater Than a Given Value

You might also like