The document outlines the SQL commands for creating three tables: DEPT, EMP, and SALGRADE, including their respective constraints and relationships. It also includes various data manipulation commands to insert records into these tables. Additionally, it demonstrates modifications to the EMP table, such as adding and dropping columns and constraints.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
5 views3 pages
tp3.sql
The document outlines the SQL commands for creating three tables: DEPT, EMP, and SALGRADE, including their respective constraints and relationships. It also includes various data manipulation commands to insert records into these tables. Additionally, it demonstrates modifications to the EMP table, such as adding and dropping columns and constraints.
alter table EMP add constraint const_sal check (sal>=600)
alter table EMP drop constraint const_sal
alter table EMP rename column comm to commission
alter table EMP add lname char(4)
alter table EMP modify column lname varchar(50) ;
alter table EMP drop column lname
create synonym employee for EMP
drop synonym employee
part2
insert into DEPT values(10,'ACCOUNTING','new york')
insert into DEPT values(20,'RESEARCH','DALLAS')
insert into DEPT values(30,'SALES','chicago')
insert into DEPT values(40,'OPERATIONS','boston')
insert into SALGRADE values(1,700,1200)
insert into SALGRADE values(2,1201,1400)
insert into SALGRADE values(3,1401,2000)
insert into SALGRADE values(4,2001,3000)
insert into SALGRADE values(5,3001,9999)
insert into EMP(empno,ename,job,mgr,hiredate,sal,commission,deptno)
values(7839,'king','president',null, date '2008-06-02',5,null,30)
insert into EMP(empno,ename,job,mgr,hiredate,sal,commission,deptno)
values(7521,'ward','salesman',7839, date '2001-02-21',10,50,30) insert into EMP(empno,ename,job,mgr,hiredate,sal,commission,deptno) values(7654,'martin','salesman',7839, date '2011-11-06',10,50,30)
insert into EMP(empno,ename,job,mgr,hiredate,sal,commission,deptno)
values(7698,'blake','manager',7839, date '2009-04-01',10,null,30)
insert into EMP(empno,ename,job,mgr,hiredate,sal,commission,deptno)
values(7566,'jones','manager',7698, date '2008-09-01',22,null,20)
insert into EMP(empno,ename,job,mgr,hiredate,sal,commission,deptno)
values(7788,'scott','analyst',7698, date '2008-12-17',33,null,10)