SQL Programmes
1. This table contains details about
students.
Sample Data:
Query 1: Retrieve all students in Class 12A.
Input:-
Output:-
Query 2: Count the number of male students.
Input:-
Output:-
Query 3: Find the average age of students.
Input:-
Output:-
Query 4: List all students whose name starts with 'A'.
Input:-
Output:-
Query 5: Retrieve the names of students older than 16
Input:-
Output:-
2. This table contains detail of the
subjects
Sample Data:
Querie 1:- List all subjects taught by Dr. Verma.
Input:-
Output:-
Queries 2:- Find the total number of subject
Input:-
Output:-
Queries 3:- Retrieve subject names sorted
alphabetically.
Input:-
Output:-
Queries 4:- Update the teacher for Biology to ‘Dr.
Gupta’.
Input:-
Output:-
The record for Biology will have the updated teacher
Queries 5:- Delete the subject chemistry.
Input:-
Output:-
The record for chemistry will be removed.
3. This table contains detail of the
Programs.
Sample Data:-
Querie 1:- Retrieve all programs written by Python.
Input:-
Output:-
Queries 2:- Count programs with difficulty level
‘Medium’.
Input:-
Output:-
Queries 3:- Find programs with more than 40 lines of
code.
Input:-
Output:-
Queries 4:- Update the difficulty level of ‘Sorting
Algorithm’ to ‘Very Hard’.
Input:-
Output:-
The record for "Sorting Algorithm" now has "Very
Hard" as the difficulty level.
Queries 5:- Delete programs written in SQL
Input:-
Output:-
The record for "Database CRUD" will be removed.
4. This table contains detail of the
Teachers.
Sample Data:-
Queries 1:- Retrieve all teachers with more than 10
years of experience.
Input:-
Output:-
Queries 2:- Count the number of teachers with a Ph.D.
qualification.
Input:-
Output:-
Queries 3:- List the names of teachers who teach
science subject (Physics, Chemistry, Biology)
Input:-
Output:-
Queries 4:- Update the experience of ‘Ms. Banerjee’ to
10 years.
Input:-
Output:-
Ms. Banerjee’s experience will now be updated to
10 years.
Queries 5:- Delete records of teachers with less than 9
years experience.
Input:-
Output:- Records for “Ms. Banerjee” and “Dr. Reddy”
will be removed.
5. This table contains detail of the
Projects.
Sample Data:-
Queries 1:- Retrieve all projects submitted before
January 15, 2024.
Input:-
Output:-
Queries 2:- Count the number of project with marks
greater than 85.
Input:-
Output:-
Queries 3;- List the names of projects along with their
marks, sorted by marks in descending order.
Input:-
Output:-
Queries 4:- Update the marks for ‘Quiz App’ to 85.
Input:-
Output:-
The record for “Quiz App” will now show 85
marks.
Queries 5:- Delete project submitted by studentID = 5.
Input:-
Output:- The record for “Weather Forecast” will be
removed