Q. No 4
— Find the name of teacher which from biratnagar or dharan
select TNAME FROM TEACHER WHERE ADDRESS=’BIRATNAGAR’ OR ADDRESS=’DHARAN’ ;
SELECT TNAME FROM TEACHER WHERE ADDRESS IN(‘BIRATNAGAR’,’DHARAN’);
— Find the name of teacher who teaches database managemnet system
SELECT TNAME FROM TEACHER
WHERE TID IN(SELECT TID FROM TEACH WHERE SID =(SELECT SID FROM SUBJECT WHERE SUBNAME=’DATABASEMANAGEMENTSYSTEM’));
— Update address of a teacher to putalisadak who teaches economics
UPDATE TEACHER SET ADDRESS=’PUTALISADAK’ WHERE TID IN
(SELECT TID FROM TEACH WHERE SID =(SELECT SID FROM SUBJECT WHERE SUBNAME=’ECONOMICS’));
— Delete the subject which is taught by ramesh.
DELETE FROM SUBJECT WHERE SID IN(SELECT SID FROM TEACH WHERE TID IN(SELECT TID FROM TEACHER WHERE TNAME=’RAMESH’));
— Add one attribute sub_type(varchar(20)) in relation subject.
ALTER TABLE SUBJECT
ADD SUB_TYPE VARCHAR(20) NOT NULL;
— ALTER TABLE TABLENMAE
— ADD COLUMNNAME DATATYPE CONSTRAINTTYPE;