Assignment Constraints and OPerators
Assignment Constraints and OPerators
ANSWER :
ANSWER:
INSERT INTO TIU_BCS (Student_Name, Roll_number, Semester, Age, Gender,
Phone_no, City, Dept_name, Dept_id, CR_rollno)
VALUES
('Alice Smith', 1001, 'Semester 1', 20, 'FEMALE', '9876543210',
'KOLKATA', 'CSE', 101, NULL),
('Bob Johnson', 1002, 'Semester 2', 22, 'MALE', '9876543211',
'KOLKATA', 'ECE', 102, NULL),
('Carol Davis', 1003, 'Semester 1', 21, 'FEMALE', '9876543212',
'KOLKATA', 'IT', 103, NULL),
('David Wilson', 1004, 'Semester 3', 23, 'MALE', '9876543213',
'KOLKATA', 'MECH', 104, NULL),
('Eva Brown', 1005, 'Semester 2', 22, 'FEMALE', '9876543214',
'KOLKATA', 'CIVIL', 105, NULL),
('Frank Moore', 1006, 'Semester 4', 24, 'MALE', '9876543215',
'KOLKATA', 'CSE', 101, 1001),
('Grace Taylor', 1007, 'Semester 1', 20, 'FEMALE', '9876543216',
'KOLKATA', 'ECE', 102, 1002),
('Hank Lee', 1008, 'Semester 2', 21, 'MALE', '9876543217',
'KOLKATA', 'IT', 103, 1003),
('Ivy Clark', 1009, 'Semester 3', 22, 'FEMALE', '9876543218',
'KOLKATA', 'MECH', 104, 1004),
('Jack Lewis', 1010, 'Semester 4', 23, 'MALE', '9876543219',
'KOLKATA', 'CIVIL', 105, 1005),
('Kimberly Martin', 1011, 'Semester 1', 20, 'FEMALE',
'9876543220', 'KOLKATA', 'CSE', 101, NULL),
('Liam Walker', 1012, 'Semester 2', 22, 'MALE', '9876543221',
'KOLKATA', 'ECE', 102, 1002),
('Mona Scott', 1013, 'Semester 3', 21, 'FEMALE', '9876543222',
'KOLKATA', 'IT', 103, 1003),
('Nate Adams', 1014, 'Semester 4', 23, 'MALE', '9876543223',
'KOLKATA', 'MECH', 104, 1004),
('Olivia Thompson', 1015, 'Semester 1', 20, 'FEMALE',
'9876543224', 'KOLKATA', 'CIVIL', 105, 1005),
('Paul King', 1016, 'Semester 2', 22, 'MALE', '9876543225',
'KOLKATA', 'CSE', 101, 1001),
('Quinn Green', 1017, 'Semester 3', 21, 'FEMALE', '9876543226',
'KOLKATA', 'ECE', 102, 1002),
('Rita Baker', 1018, 'Semester 4', 23, 'FEMALE', '9876543227',
'KOLKATA', 'IT', 103, 1003),
('Steve Wright', 1019, 'Semester 1', 20, 'MALE', '9876543228',
'KOLKATA', 'MECH', 104, 1004),
('Tina Harris', 1020, 'Semester 2', 22, 'FEMALE', '9876543229',
'KOLKATA', 'CIVIL', 105, 1005);
ANSWER:
5. Retrieve Roll number, Name and city of the students whose name
starts with ‘O’.
OR
OR
9. Update the Emails of Employee having names Alice, Grace, and Kate.
10. Display the details of the Employees who don’t have any valid
email id.
ANSWER:
CREATE TABLE Student_CR
(CR_id INT PRIMARY KEY,
Roll_number NUMERIC(4) NOT NULL,
CR_start_date DATE NOT NULL,
CR_end_date DATE,
Department VARCHAR(50),
FOREIGN KEY (Roll_number) REFERENCES TIU_BCS (Roll_number));
13. Find the students’ roll numbers who are considered as class
representative.
ANSWER:
17. Find all students who are class representatives and their marks.
19. List all class representatives along with their department and
marks for a specific subject.
20. Find students who are not class representatives and list their
marks.
23. Get the details of students and their marks that belong to a
specific department and are class representatives.
24. List students who have not taken any exams (i.e., have no entries
in the Marks table).
25. Find all subjects and their average marks for students in a
specific department.