0% found this document useful (0 votes)
8 views2 pages

Insert A New Department

Hello All things this is ok and all okk

Uploaded by

mrh21615
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Insert A New Department

Hello All things this is ok and all okk

Uploaded by

mrh21615
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Insert a New Department:

sql
Copy code
INSERT INTO departments (department_name) VALUES ('Computer Science')
Add a New Faculty Member:

sql
Copy code
INSERT INTO faculties (faculty_name, position) VALUES ('Dr. John Doe', 'Professor')
Add a New Student:

sql
Copy code
INSERT INTO students (enrolment_no, admission_date, name, age, email, phone,
address, admission_fees, department_id)
VALUES ('2024001', TO_DATE('06/10/2023', 'DD/MM/YYYY'), 'Alice Johnson', 20,
'[email protected]', '9876543210', '123 Main St', 1500, 1)
Retrieve All Students in a Specific Department:

sql
Copy code
SELECT name, enrolment_no FROM students WHERE department_id = 1
Update Faculty Position:

sql
Copy code
UPDATE faculties SET position = 'Assistant Professor' WHERE faculty_name = 'Dr.
John Doe'
Delete a Student Record:

sql
Copy code
DELETE FROM students WHERE enrolment_no = '2024001'
View All Faculty Members:

sql
Copy code
SELECT * FROM faculties
Calculate the Total Admission Fees Collected:

sql
Copy code
SELECT SUM(admission_fees) AS total_fees FROM students
List Students Enrolled After a Specific Date:

sql
Copy code
SELECT name, enrolment_no FROM students WHERE admission_date >
TO_DATE('01/01/2024', 'DD/MM/YYYY')
Count the Number of Students in Each Department:

sql
Copy code
SELECT department_id, COUNT(*) AS student_count FROM students GROUP BY
department_id
Find the Average Age of Students:
sql
Copy code
SELECT AVG(age) AS average_age FROM students
Display All Departments:
sql
Copy code
SELECT * FROM departments
Find Students with Admission Fees Greater Than a Certain Amount:
sql
Copy code
SELECT name, admission_fees FROM students WHERE admission_fees > 1000
Retrieve Faculty Members in a Specific Position:
sql
Copy code
SELECT faculty_name FROM faculties WHERE position = 'Professor'
Join Students and Departments to Show Student Names and Their Departments:
sql
Copy code
SELECT s.name AS student_name, d.department_name
FROM students s
JOIN departments d ON s.department_id = d.department_id

You might also like