Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

use university;

-- !!!!!!! SELECT QUERIES !!!!!!!!!!!


Select * from Department;
Select * from Courses;
Select * from student;
Select * from instructor;
Select * from Student_attendance;
Select * from Instructor_attendance;
Select * from fees;
Select * from Salary;
Select * from Student_Subject;
Select * from Student_Grade;

-- !!!!!!! DELETE QUERIES !!!!!!!!!!!

-- DELETE QUERY FOR DATA


DELETE FROM student WHERE StudentID='BCS016';

-- DELETE QUERY FOR ALL DATA


TRUNCATE TABLE courses;

-- DELETE QUERY FOR TABLES

DROP TABLE student;

-- DELETE QUERY FOR COLUMN

ALTER TABLE department


DROP COLUMN Program;

-- DELETE QUERY FOR DATABASE

DROP DATABASE university;

-- ---------------------------------------------------------------------------

-- !!!!!!! UPDATE QUERIES !!!!!!!!!!!

-- UPDATE QUERY

UPDATE table_name
SET Program = 'Information Technology'
WHERE DeptID = 2;

-- ---------------------------------------------------------------------------

-- !!!!!!! JOIN QUERIES !!!!!!!!!!!

-- JOIN QUERY FOR STUDENT


SELECT StudentName, FatherName, DateOfBirth, DeptName, Program, Gender, Email,
Address, PhoneNumber,
NTS_Marks,student_attendance.Date_, Attendance, Subject1, Grade1,Subject2,
Grade2,Subject3, Grade3,
Amount, FeeStatus
from student
join department
on student.DeptID=department.DeptID
join student_attendance
on student_attendance.StudentID = student.StudentID
join student_subject
on student_subject.StudentID = student.StudentID
join student_grade
on student_grade.StudentID = student.StudentID
join fees
on fees.StudentID = student.StudentID
where student.StudentID = 'BCS016';

-- JOIN QUERY FOR INSTRUCTOR

SELECT InstructorName, instructor.DateOfBirth, DeptName, Program,


instructor.Gender,
instructor.Email, instructor.Address, instructor.PhoneNumber,
Education,Post, CourseName,
CreditHours,instructor_attendance.Date_,instructor_attendance.Attendance,
CourseName,CreditHours,salary.Date_,salary.Amount,SalaryStatus
from instructor
join department
on instructor.DeptID=department.DeptID
join instructor_attendance
on instructor_attendance.InstructorID = instructor.InstructorID
join courses
on courses.CourseID = instructor.CourseID
join salary
on salary.InstructorID = instructor.InstructorID
where instructor.InstructorID = 'ESE01';

You might also like