SQL QUREIES
Make the combination of DNO and PRJ_NO as primary key in the table PROJ.
ALTER TABLE PROJ ADD PRIMARY KEY(DNO,PRJ_NO);
Add a new column Dept_Budget column of size 7 digits to the DEPT table.
ALTER TABLE DEPART ADD DEPT_BUDEGET NUMBER(7);
Add a new column Prj_Fund column of size 7 digits to the PROJ table.
ALTER TABLE PROJ ADD Prj_Fund NUMBER(7);
------------------------------------------------------- INSERT-------------------------------------------------------------
INSERT DATA INTO PROJ, EMP, DEPART.
-------------------------------------------------------DEPART-------------------------------------------------------------
insert INTO DEPART (DNO, DNAME, LOCATION, DEPT_BUDGET)
VALUES
(NULL,'CORPORATE','HYD',700000);
VALUES
('D2','ACCOUNT','HYD',500000);
VALUES
('D3','RESEARCH','MNG',300000);
VALUES
('D4','IT','BNG',400000);
VALUES
('D5','HR','BNG',200000);
------------------------------------------------------- PROJ----------------------------------------------------------------
------------------------------------------------------- EMP---------------------------------------------------------------
-------------------------------------------------------UPDATE-------------------------------------------------------------
UPDATE EMP SET MGRID=111 WHERE EMPNO=101
/*MGRID NUMBER MUDT BE PRESENTED IN EMPNO OTHER WISE ERROR OCCUR*/
UPDATE PROJ SET DNO='D5' WHERE DNO='D1';
//GET ERROR.
UPDATE EMP SET COMM=10000 WHERE JOB='MGR'
-------------------------------------------------------COMMIT------------------------------------------------------------
COMMIT;
// TO SAVE/PRESERVE DATA FROM DATA DELETION.
-----------------------------------------------------ROLLBACK----------------------------------------------------------
ROLLBACK;
// TO RETRIVE DELETED DATA.
Comments
Post a Comment