Dbms Lab 1-10

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

CREATE TABLE ACCOUNT(acc_no varchar2(5),Name varchar2(30),City varchar2(20),Bala

nce number(10,2),loan_taken varchar2(5));


CREATE TABLE LOAN(loan_no varchar2(5),acc_no varchar2(5),loan_amt number(10,2),i
nterest_rate number(5,2),loan_date date,remaining_loan number(10,2));
CREATE TABLE INSTALLMENT(loan_no varchar2(5),inst_no varchar2(5),inst_Date date,
Amount number(10,2));
CREATE TABLE TRANSACTION(acc_name varchar2(5),tr_Date date,Amt number(10,2),type
_of_tr char(1),mode_of_pay varchar2(10));
INSERT INTO ACCOUNT VALUES('A001','Patel Jigar','Mehsana',50000,'YES');
INSERT INTO ACCOUNT VALUES('A002','Patel Ramesh','Ahmedabad',50000,'YES');
INSERT INTO ACCOUNT VALUES('A003','Dave Hardik','Ahmedabad',75000,'NO');
INSERT INTO ACCOUNT VALUES('&acc_no','&name','&city','&balance','&loan_taken');
INSERT INTO LOAN VALUES('&Loan_no','&Acc_no','&Loan_amt','&Intrest_rate','&Loan_
date','&Remaining_loan');
INSERT INTO INSTALLMENT VALUES('&loan_no','&inst_no','&inst_Date','&Amount');
INSERT INTO TRANSACTION VALUES('&acc_no','&tr_Date','&Amt','&type_of_tr','&mode_
of_pay');
CREATE TABLE DEPOSIT(ACTNO number(5,2),CNAME varchar2(10),BNAME varchar2(10),AMO
UNT number (10,2),ADATE date);
CREATE TABLE BRANCH(BNAME VARCHAR2(10),CITY VARCHAR2(10));
CREATE TABLE CUSTOMERS(CNAME VARCHAR2(10),CITY VARCHAR2(10));
CREATE TABLE BORROW(LOANNO VARCHAR2(5),CNAME VARCHAR2(10),BNAME VARCHAR2(10),AMO
UNT NUMBER(7,2));
INSERT INTO DEPOSIT VALUES('&ACTNO','&CNAME','&BNAME','&AMOUNT','&ADATE');
INSERT INTO BRANCH VALUES('&CNAME');
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT

INTO
INTO
INTO
INTO
INTO
INTO
INTO

CUSTOMERS
CUSTOMERS
CUSTOMERS
CUSTOMERS
CUSTOMERS
CUSTOMERS
CUSTOMERS

VALUES('ANIL','CALCUTTA');
VALUES('SUNIL','DELHI');
VALUES('MEHUL','BARODA');
VALUES('MANDAR','PATNA');
VALUES('MADHURI','NAGPUR');
VALUES('PRAMOD','NAGPUR');
VALUES('SANDIP','SURAT');

INSERT INTO CUSTOMERS VALUES('SHIVANI','BOMBAY');


INSERT INTO CUSTOMERS VALUES('KRANTI','BOMBAY');
INSERT INTO CUSTOMERS VALUES('NAREN','BOMBAY');
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT

INTO
INTO
INTO
INTO
INTO
INTO

BORROW
BORROW
BORROW
BORROW
BORROW
BORROW

VALUES('201','ANIL','VRCE',1000);
VALUES('206','MEHUL','AJNI',5000);
VALUES('311','SUNIL','DHARAMPETH',3000);
VALUES('321','MADHURI','ANDHERI',2000);
VALUES('375','PRMOD','VIRAR',8000);
VALUES('481','KRANTI','NEHRUPLACE',3000);

desc DEPOSIT;
desc BRANCH;
desc BORROW;
desc CUSTOMERS;
SELECT * FROM DEPOSIT;
SELECT * FROM BORROW;
SELECT * FROM CUSTOMERS;
SELECT * FROM BRANCH;
SELECT ACTNO FROM DEPOSIT;
SELECT AMOUNT FROM DEPOSIT;
*******PRACTICAL ACCCOUNT******
UPDATE ACCOUNT SET NAME='Patel Hiren' where name='Patel Jigar';
UPDATE ACCOUNT SET NAME ='Kothari Nehal',city='Patan' where acc_no='A005';
SELECT * FROM ACCOUNT WHERE LOAN_TAKEN='YES';
ALTER TABLE ACCOUNT ADD(address varchar2(20));
CREATE TABLE ACCOUNT_TEMP(acc_no,name,balance) as select acc_no,name,balance fro
m ACCOUNT;
RENAME ACCOUNT TO ACCOUNT_MASTER;
UPDATE ACCOUNT_MASTER SET BALANCE=BALANCE*2;
DESC ACCOUNT_MASTER;
DELETE FROM ACCOUNT_MASTER WHERE ACC_NO='A004';

********PRACTICAL LOAN********
UPDATE LOAN SET LOAN_AMT=LOAN_AMT+100000;
UPDATE LOAN SET INTEREST_RATE=INTEREST_RATE+2;
CREATE TABLE LOAN_TEMP(LOAN_NO,ACC_NO,LOAN_AMT,LOAN_DATE) AS LOAN_NO,ACC_NO,LOAN
_AMT,LOAN_DATE FROM LOAN;
SELECT * FROM LOAN WHERE TO_CHAR(LOAN_DATE,'MON')='JAN';
ALTER TABLE LOAN ADD(CREDIT_NO VARCHAR2(4));
SELECT LOAN_AMT*2 FROM LOAN;
SELECT * FROM LOAN ORDER BY LOAN_DATE;
SELECT * FROM LOAN ORDER BY ACC_NO DESC;
ALTER TABLE LOAN MODIFY(ACCOUNT_NO VARCHAR2(7));
******PRACTICAL- INSTALLMENT******
UPDATE INSTALLMENT SET INST_DATE='3-MAR-04' WHERE INST_DATE= '2-FEB-04';
UPDATE INSTALLMENT SET AMOUNT=AMOUNT-5000;
*>UPDATE INSTALLMENT SET AMOUNT=AMOUNT+5000 WHERE LOAN_NO='L003'OR LOAN_NO='L004
';
ALTER TABLE INSTALLMENT MODIFY(LOAN_NO VARCHAR2(7));
ALTER TABLE INSTALLMENT MODIFY(INST_NO VARCHAR2(4));
DESC INSTALLMENT;
UPDATE INSTALLMENT SET AMOUNT=5000 WHERE UPDATE LOAN_NO='L001';
DELETE FROM INSTALLMENT WHERE LOAN_NO='L001';
CREATE TABLE INSTALLMENT1 AS SELECT * FROM INSTALLMENT WHERE 1=2;
*********PRACTICAL TRANSACTION********
INSERT INTO TRANSACTION VALUES('A001','03-MAY-04',100000,'D','CASH');
SELECT DISTINCT * FROM TRANS;
SELECT * FROM TRANSACTION ORDER BY ACC_NAME DESC;
SELECT AMT,TR_DATE,TYPE_OF_TR FROM TRANSACTION ORDER BY TR_DATE;
CREATE TABLE TRANSACTION_TEMP AS SELECT * FROM TRANSACTION;
CREATE TABLE TRANS_TEMP(ACCOUNT_NAME,TR_DATE,AMT,TYPE_OF_TR,MODE_OF_PAY)AS SELEC
T ACC_NAME,TR_DATE,AMT,TYPE_OF_TR,MODE_OF_PAY FROM TRANSACTION;
DROP TRANSACTION_TEMP;

RENAME TRANSACTION TO TRANS;


CREATE TABLE TRANS1 AS SELECT * FROM TRANS WHERE 1=2;
SELECT * FROM TRANS WHERE TYPE_OF_TR='D';

**********PRACTICAL-3**********
CREATE TABLE ACCOUNT(Acc_no varchar2(5),Name varchar2(30),City varchar2(20),Bala
nce number(10,2),Loan_taken varchar2(3));
CREATE TABLE LOAN(Loan_no varchar2(5),Acc_no varchar2(5),Loan_amt number(10,2),I
nterest_rate number(5,2),Loan_date date,Remaining_loan number(10,2));
CREATE TABLE INSTALLMENT(Loan_no varchar2(5),Inst_no varchar2(5),IDate date,Amou
nt number(10,2));
CREATE TABLE TRANSACTION(Acc_no varchar2(5),Trans_date date,Amt number(10,2),Typ
e_of_tr char(1),Mode_of_pay varchar2(10));
INSERT INTO ACCOUNT VALUES('A001','Patel Jigar','Mehsana',50000,'YES');
INSERT INTO ACCOUNT VALUES('A002','Patel Ramesh','Mehsana',50000,'YES');
INSERT INTO ACCOUNT VALUES('A003','Dave Hardik','Ahmedabad',75000,'NO');
INSERT INTO ACCOUNT VALUES('A004','Soni Hetal','Ahmedabad',100000,'NO');
INSERT INTO ACCOUNT VALUES('A005','Sony Atul','Vadodara',100000,'YES');
INSERT INTO LOAN VALUES('L001','A001',100000,7,'1-JAN-04',75000);
INSERT INTO LOAN VALUES('L002','A002',300000,9,'18-MAY-04',150000);
INSERT INTO LOAN VALUES('L003','A003',500000,11,'15-JUNE-04',300000);
INSERT INTO INSTALLMENT VALUES('L001','I001','2-FEB-04',15000);
INSERT INTO INSTALLMENT VALUES('L002','I002','18-JUNE-04',20000);
INSERT INTO INSTALLMENT VALUES('L003','I003','15-JULY-04',20000);
INSERT INTO TRANSACTION VALUES('A001','3-MAY-04',10000,'D','CASH');
INSERT INTO TRANSACTION VALUES('A002','5-JULY-04',5000,'W','CHEQUE');
INSERT INTO TRANSACTION VALUES('A003','12-AUG-04',25000,'D','CHEQUE');
INSERT INTO TRANSACTION VALUES('A004','15-MAY-04',30000,'D','CHEQUE');
INSERT INTO TRANSACTION VALUES('A005','22-MAY-04',15000,'W','CASH');
***************GTU TABLES*************
CREATE TABLE JOB(JOB_ID VARCHAR2(15),JOB_TITLE VARCHAR2(30),MIN_SAL NUMBER(7,2),

MAX_SAL NUMBER(7,2));
CREATE TABLE EMPLOYEE(EMP_NO NUMBER(3),EMP_NAME VARCHAR2(30),EMP_SAL NUMBER(8,2)
,EMP_COMM NUMBER(6,1),DEPT_NO NUMBER(3));
CREATE TABLE DEPOSITGTU(A_NO VARCHAR2(5),CNAME VARCHAR2(15),BNAME VARCHAR2(10),A
MOUNT NUMBER(7,2),A_DATE DATE);
CREATE TABLE BORROWGTU(LOANNO VARCHAR2(5),CNAME VARCHAR2(15),BNAME VARCHAR2(10),
AMOUNT NUMBER(7,2));
************TO INSERT VALUES OF EMPLOYEE***********
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
NO');

INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO

EMPLOYEE
EMPLOYEE
EMPLOYEE
EMPLOYEE
EMPLOYEE
EMPLOYEE
EMPLOYEE
EMPLOYEE

VALUES(101,'SMITH',800,0,20);
VALUES(102,'SNEHAL',1600,300,25);
VALUES(103,'ADAMA',1100,0,20);
VALUES(104,'AMAN',3000,0,15);
VALUES(105,'ANITA',5000,50000,10);
VALUES(106,'SNEHA',2450,24500,10);
VALUES(107,'ANAMIKA',2975,'NULL',30);
VALUES('&EMP_NO','&EMP_NAME','&EMP_SAL','&EMP_COMM','&DEPT_

************TO INSERT VALUES OF JOB***********


INSERT
INSERT
INSERT
INSERT
INSERT
INSERT

INTO
INTO
INTO
INTO
INTO
INTO

JOB
JOB
JOB
JOB
JOB
JOB

VALUES('IT_PROG','PROGRAMMER',4000,10000);
VALUES('MK_MGR','MARKETING MANAGER',9000,15000);
VALUES('FI_MGR','FINANCE MANAGER',8200,12000);
VALUES('FI_ACC','ACCOUNT',4200,9000);
VALUES('LEC','LECTURER',6000,17000);
VALUES('COMP_OP','COMPUTER OPERATOR',1500,3000);

************TO INSERT VALUES OF DEPOSIT***********


INSERT
INSERT
INSERT
INSERT
INSERT
INSERT

INTO
INTO
INTO
INTO
INTO
INTO

DEPOSITGTU
DEPOSITGTU
DEPOSITGTU
DEPOSITGTU
DEPOSITGTU
DEPOSITGTU

VALUES(101,'ANIL','ANDHERI',7500,'01-JAN-06');
VALUES(102,'SUNIL','VIRAR',5000,'15-JUL-06');
VALUES(103,'JAY','VILLEPARLE',6500,'12-MAR-06');
VALUES(104,'VIJAY','ANDHERI',8000,'17-SEP-06');
VALUES(105,'KEYUR','DADAR',7500,'19-NOV-06');
VALUES(106,'MAYUR','BORIVALI',5500,'21-DEC-06');

**********PRACTICE PRACTICAL 3**************


ALTER TABLE TRANS RENAME COLUMN "ACC_NAME" TO "ACC_NO";
SELECT EMP_NAME "NAME OF EMPLOYEE",EMP_SAL "SALARY OF EMPLOYEE" FROM EMPLOYEE WH
ERE DEPT_NO=20;
RENAME LOAN TO LOAN_MASTER;
RENAME TRANS TO TRANSACTION_MASTER;
RENAME INSTALLMENT TO INSTALLMENT_MASTER;
CREATE TABLE ACCOUNT(ACC_NO VARCHAR2(5) PRIMARY KEY,NAME VARCHAR2(30) NOT NULL,C
ITY VARCHAR2(20) NOT NULL,BALANCE NUMBER(10,2),LOAN_TAKEN VARCHAR2(3),CHECK(ACC_
NO LIKE 'A%'),CHECK(BALANCE>=500),C
HECK(LOAN_TAKEN='YES' OR LOAN_TAKEN='NO'));

INSERT INTO ACCOUNT VALUES('A001','Patel Jigar','Mehsana',50000,'YES');


INSERT INTO ACCOUNT VALUES('A002','Patel Ramesh','Ahmedabad',50000,'YES');
INSERT INTO ACCOUNT VALUES('A003','Dave Hardik','Ahmedabad',75000,'NO');
INSERT INTO ACCOUNT VALUES('A004','Soni Hetal','Ahmedabad',100000,'NO');
INSERT INTO ACCOUNT VALUES('A005','Sony Atul','Vadodara',100000,'YES');
CREATE TABLE LOAN(LOAN_NO VARCHAR2(5) PRIMARY KEY,ACC_NO VARCHAR2(5) REFERENCES
ACCOUNT(ACC_NO)
,LOAN_AMT NUMBER(10,2) NOT NULL,INTEREST_RATE NUMBER(5,2) NOT NULL,LOAN_DATE DAT
E,REMAINING_LOAN NUM
BER(10,2),CHECK(LOAN_NO LIKE 'L%'),CHECK(REMAINING_LOAN<LOAN_AMT));

CREATE TABLE INSTALLMENT(LOAN_NO VARCHAR2(5) REFERENCES LOAN(LOAN_NO),INST_NO VA


RCHAR2(5),IDATE DATE NOT NULL,AMOUNT NUMBER(10,2) NOT NULL,CHECK(INST_NO LIKE 'I
%'));

CREATE TABLE TRANSACTION(ACC_NO VARCHAR2(5) REFERENCES ACCOUNT(ACC_NO),TRANS_DAT


E DATE NOT NULL,AMT NUMBER(10,2) NOT NULL,TYPE_OF_TR CHAR(1),MODE_OF_PAY VARCHAR
2(10),CHECK(TYPE_OF_TR='D' OR TYPE_OF_TR='W'),CHECK(MODE_OF_PAY='CASH' OR MODE_O
F_PAY='CHEQUE'));
SELECT * FROM ACCOUNT WHERE NOT CITY='Ahmedabad';
SELECT * FROM ACCOUNT WHERE CITY NOT IN('Ahmedabad','Vadodara');
SELECT * FROM ACCOUNT WHERE BALANCE BETWEEN 50000 AND 100000;
SELECT * FROM ACCOUNT WHERE BALANCE NOT BETWEEN 50000 AND 100000;
SELECT * FROM INSTALLMENT WHERE AMOUNT IN('5000','25000','30000');
SELECT * FROM INSTALLMENT WHERE AMOUNT NOT IN('5000','25000','30000');
SELECT SYSDATE FROM DUAL;
SELECT SYSDATE+15 FROM DUAL;
SELECT 5*5 FROM DUAL;
SELECT 34+34 FROM DUAL;
SELECT 1000/300 FROM DUAL;
SELECT LENGTH ('AJAY') FROM DUAL;
SELECT TO_CHAR(SYSDATE,'MON') FROM DUAL;
SELECT SYSDATE-20 FROM DUAL;

***************2********************
SELECT SUM(AMT) AS total_TRANSACTIO_AMOUNT FROM TRANSACTION;
SELECT MAX(AMT) FROM TRANSACTION;
SELECT MIN(AMT) FROM TRANSACTION;
SELECT COUNT(ACC_NO) FROM TRANSACTION;
SELECT COUNT(ACC_NO) FROM TRANSACTION WHERE MODE_OF_PAY='CASH';
SELECT COUNT(ACC_NO) FROM TRANSACTION WHERE TO_CHAR(TRANS_DATE,'MON')='MAY';
SELECT AVG(AMT) FROM TRANSACTION;
SELECT POWER(4,4) FROM DUAL;
SELECT SQRT(25) FROM DUAL;
SELECT LOWER('AJAY') LOWER FROM DUAL;
SELECT UPPER('ajay') MY_NAME FROM DUAL;
SELECT SUBSTR('AJAY',2,3) SUB_STR FROM DUAL;
SELECT LENGTH('AJAY') FROM DUAL;
SELECT LTRIM('AJAY_VASANT','A') FROM DUAL;
SELECT RTRIM('AJAY_VASANT','NT') FROM DUAL;
SELECT LPAD('AJAY',10,'*') LPAD FROM DUAL;
SELECT RPAD('AJAY',10,'*') RPAD FROM DUAL;
SELECT INITCAP('ajay_vasant') FROM DUAL;

***************************************************************************

CREATE TABLE STUDENT(ROLLNO VARCHAR2(6),NAME VARCHAR2(20),BRANCH VARCHAR2(6),ADD


RESS VARCHAR2(20));
ALTER TABLE STUDENT ADD CONSTRAINT PRIM_ROLLNO PRIMARY KEY(ROLLNO);
ALTER TABLE STUDENT MODIFY(NAME CONSTRAINT NOTNULL1 NOT NULL,BRANCH CONSTRAINT N
OTNULL2 NOT NULL);

ALTER TABLE STUDENT ADD CONSTRAINT CK CHECK(NAME=UPPER(NAME));


ALTER TABLE STUDENT DROP PRIMARY KEY;
ALTER TABLE STUDENT DROP CONSTRAINT NOTNULL1;
ALTER TABLE STUDENT DROP CONSTRAINT NOTNULL2;
ALTER TABLE STUDENT DROP CONSTRAINT CK;
ALTER TABLE REGISTER ADD FOREIGN KEY(ROLLNO)REFERENCES STUDENT;
ALTER TABLE REGISTER ADD CONSTRAINT CK CHECK(SUBSTR(NAME,1)=UPPER(SUBSTR(NAME,1,
1)));
ALTER TABLE REGISTER MODIFY(NAME CONSTRAINT NOTNULL1 NOT NULL);
ALTER TABLE REGISTER DROP CONSTRAINT NOTNULL1;
ALTER TABLE REGISTER DROP CONSTRAINT NOTNULL2;

***************************GTU PRACTICAL - 3*********************


SELECT ACTNO,AMOUNT FROM DEPOSIT WHERE ADATE BETWEEN '01-JAN-06' AND '25-JUL-06'
;
SELECT EMP_NO,EMP_NAME,DEPT_NO FROM EMPLOYEE WHERE DEPT_NO BETWEEN '10' AND '20'
;
SELECT * FROM EMPLOYEE WHERE EMP_NAME LIKE 'A_A%';
SELECT EMP_NAME,EMP_NO,EMP_SAL FROM EMPLOYEE WHERE EMP_NAME LIKE 'ANI__%';
SELECT * FROM EMPLOYEE WHERE EMP_COMM IS NOT NULL AND EMP_NAME LIKE '_N___';
SELECT * FROM EMPLOYEE WHERE EMP_COMM IS NULL AND EMP_NAME LIKE '__A%';
************************GTU PRACTICAL-3*********************
SELECT SUM(AMOUNT) TOTAL_DEPOSIT FROM DEPOSIT;
SELECT COUNT(LOANNO) TOTAL_LOAN FROM BORROW WHERE BNAME='KAROLBAGH';(EXCEPTION)
SELECT COUNT(LOANNO) TOTAL_LOAN FROM BORROW WHERE BNAME='ANDHERI';
SELECT MAX(AMOUNT) MAXIMUM_LOAN FROM BORROW WHERE BNAME='VRCE';
SELECT COUNT(CNAME) TOTAL_CUSTOMERS FROM DEPOSIT;
SELECT COUNT(CITY) CUSTOMERS_CITY FROM CUSTOMERS;
CREATE TABLE SUPPLIER AS SELECT * FROM EMPLOYEE;
CREATE TABLE SPL1(EMP_NO,EMP_NAME) AS SELECT EMP_NO,EMP_NAME FROM EMPLOYEE;

INSERT INTO SPL2 SELECT * FROM EMPLOYEE WHERE EMP_NAME LIKE '_N___';
ALTER TABLE SUPPLIER RENAME COLUMN "EMP_NO" TO "SUP_NO";(EXTRA)
DELETE FROM SUPPLIER WHERE SUP_NO='103';
TRUNCATE TABLE SUPPLIER;
DELETE FROM SUPPLIER WHERE SUP_NO BETWEEN 101 AND 107;
RENAME SPL2 TO SUPPLIER2;
DROP TABLE SPL1;
UPDATE EMPLOYEE SET DEPT_NO=10 WHERE EMP_NAME LIKE '_M%';
UPDATE EMPLOYEE SET EMP_NAME='LAB_B' WHERE EMP_NO=103;
*****************************GTU PRACTICAL-4******************
SELECT SYSDATE "DATE" FROM DUAL;
SELECT EMP_NO,JOB_ID,ROUND(EMP_SAL,0) NEW_SAL FROM EMPLOYEE,JOB;

SELECT EMP_SAL,ROUND((EMP_SAL*0.15)+EMP_SAL,0) NEW_SAL,ROUND(EMP_SAL+(EMP_SAL*0.


15)-EMP_SAL) INCREASE FROM EMPLOYEE;

SELECT INITCAP(EMP_NAME) EMPLOYEE_NAME,LENGTH(EMP_NAME) N_LENGTH FROM EMPLOYEE,D


UAL WHERE EMP_NAME LIKE'J%' OR EMP_NAME LIKE 'A%' OR EMP_NAME LIKE 'M%';
SELECT EMP_NAME ||' earns ' || EMP_SAL || ' MONTHLY'

FROM EMPLOYEE;

UPDATE EMPLOYEE SET HIRE_DATE='03-JAN-14' WHERE EMP_NO=101;


UPDATE EMPLOYEE SET HIRE_DATE='21-JUL-14' WHERE EMP_NO=102;
UPDATE EMPLOYEE SET HIRE_DATE='30-AUG-14' WHERE EMP_NO=103;
UPDATE EMPLOYEE SET HIRE_DATE='8-APR-14' WHERE EMP_NO=104;
UPDATE EMPLOYEE SET HIRE_DATE='1-DEC-14' WHERE EMP_NO=105;
UPDATE EMPLOYEE SET HIRE_DATE='4-MAY-14' WHERE EMP_NO=106;
UPDATE EMPLOYEE SET HIRE_DATE='8-JUNE-14' WHERE EMP_NO=107;

SELECT EMP_SAL+NVL(EMP_COMM,0) "EMP_COMP" FROM EMPLOYEE;

SELECT emp_name,hire_date, ROUND(MONTHS_BETWEEN (SYSDATE, hire_date)) MONTHS_WOR


KED,to_char(hire_date,'Day') "Day" from employee order by to_char(hire_date-1,'d
');

select to_char(hire_date,'fmDdspth "of" MONTH YYYY fm HH:MI:SS AM') RESULT FROM


EMPLOYEE;

******************************GTU PRACTICAL-6************************
SELECT SUM(AMOUNT) FROM DEPOSIT WHERE ADATE>'01-JAN-96';
2-SKIP
3-SKIP
SELECT MAX(EMP_SAL)-MIN(EMP_SAL) "DIFFERENCE" FROM EMPLOYEE;
SELECT ROUND(MAX(EMP_SAL)) MAXIMUM,ROUND(MIN(EMP_SAL)) MINIMUM,ROUND(SUM(EMP_SAL
)) SUM_SAL,ROUND(AVG(EMP_SAL)) AVERAGE FROM EMPLOYEE;
6-SKIP
7-SKIP
8-SKIP
9-SKIP
10-SKIP
****************************GTU PRACTICAL-5**************
SELECT SUM(BALANCE) FROM ACCOUNT_MASTER GROUP BY CITY HAVING CITY='Mehsana';
SELECT * FROM ACCOUNT WHERE BALANCE<(SELECT SUM(BALANCE) FROM ACCOUNT);
SELECT * FROM ACCOUNT,LOAN WHERE ACCOUNT.ACC_NO=LOAN.ACC_NO AND ACCOUNT.BALANCE=
LOAN.LOAN_AMT;
SELECT ACCOUNT.CITY,LOAN.REMAINING_LOAN,ACCOUNT.ACC_NO,LOAN.LOAN_DATE,LOAN.LOAN
_NO FROM ACCOUNT,LOAN WHERE ACCOUNT.ACC_NO=LOAN.ACC_NO;

SELECT ACCOUNT.NAME,INSTALLMENT.INST_NO,INSTALLMENT.AMOUNT FROM ACCOUNT,LOAN,INS


TALLMENT WHERE ACCOUNT.ACC_NO=LOAN.ACC_NO AND WHERE LOAN.LOAN_NO=INSTALLMENT.LOA
N_NO AND LOAN.LOAN_NO=L001;

SELECT ACCOUNT.NAME,INSTALLMENT.INST_NO,INSTALLMENT.AMOUNT FROM ACCOUNT,LOAN,IN


STALLMENT WHERE
ACCOUNT.ACC_NO=LOAN.ACC_NO AND LOAN.LOAN_NO=INSTALLMENT.LOAN_NO AND LOAN.LOAN_NO
='L001';

SELECT ACCOUNT.NAME,ACCOUNT.CITY,LOAN.LOAN_AMT,INSTALLMENT.AMOUNT FROM ACCOUNT,L


OAN,INSTALLMENT WHERE ACCOUNT.ACC_NO=LOAN.ACC_NO AND LOAN.LOAN_NO=INSTALLMENT.LO
AN_NO;

SELECT ACCOUNT.BALANCE,LOAN.REMAINING_LOAN FROM ACCOUNT,LOAN WHERE ACCOUNT.BAL


ANCE=LOAN.REMAINING_LOAN;

SELECT ACCOUNT.ACC_NO,ACCOUNT.NAME,ACCOUNT.CITY,ACCOUNT.BALANCE,ACCOUNT.LOAN_TAK
EN FROM ACCOUNT
,LOAN WHERE ACCOUNT.BALANCE=LOAN.LOAN_AMT;

SELECT TRANSACTION.AMT,ACCOUNT.NAME,TRANSACTION.ACC_NO,TRANSACTION.MODE_OF_PAY
FROM ACCOUNT,TRANSACTION WHERE ACCOUNT.ACC_NO=TRANSACTION.ACC_NO AND MODE_OF_PA
Y='CHEQUE';
SELECT TRANSACTION.ACC_NO,LOAN.LOAN_AMT,TRANSACTION.AMT FROM TRANSACTION,LOAN WH
ERE TRANSACTION.ACC_NO=LOAN.ACC_NO;

SELECT DISTINCT INSTALLMENT.LOAN_NO,INSTALLMENT.INST_NO,INSTALLMENT.IDATE,INSTA


LLMENT.AMOUNT FROM INSTALLMENT,TRANSACTION WHERE INSTALLMENT.AMOUNT<(SELECT AVG(
AMT) FROM TRANSACTION);
SELECT SUM(INSTALLMENT.AMOUNT),SUM(TRANSACTION.AMT) FROM INSTALLMENT,TRANSACTION
;\

SELECT TRANSACTION.AMT,ACCOUNT.BALANCE FROM ACCOUNT,TRANSACTION WHERE TRANSACTIO


N.ACC_NO=ACCOUNT.ACC_NO GROUP BY AMT,BALANCE;

SELECT DEPOSITGTU.A_NO,DEPOSITGTU.CNAME,DEPOSITGTU.BNAME,DEPOSITGTU.AMOUNT,DEPO
SITGTU.A_DATE,CUSTOMERS.CITY,BORROW.LOANNO FROM DEPOSITGTU,CUSTOMERS,BORROW WHER
E DEPOSITGTU.CNAME=CUSTOMERS.CNAME AND CUSTOMERS.CNAME=BORROW.CNAME AND DEPOSIT
GTU.CNAME='ANIL';
SELECT CUSTOMERS.CNAME FROM DEPOSITGTU,BORROW,CUSTOMERS WHERE DEPOSITGTU.CNAME=C
USTOMERS.CNAME AND CUSTOMERS.CNAME=BORROW.CNAME AND CUSTOMERS.CITY='NAGPUR';

3RD. GIVE THE NAME OF CUSTOMERS AND THEIR BRANCH NAME WHO LIVES IN NAGPUR CITY.
-> SELECT CUSTOMERS.CNAME,BRANCH.BNAME FROM BRANCH,CUSTOMERS,DEPOSIT WHERE CUST
OMERS.CITY=BRANCH.CITY AND DEPOSIT.CNAME=CUSTOMERS.CNAME AND CUSTOMERS.CITY='NAG
PUR';
4TH. WRITE A QUERY TO DISPLAY NAME,DEPT_NO FOR ALL EMPLOYEES.
-> SELECT EMP_NAME,DEPT_NO FROM EMPLOYEE;
5TH CREATE TABLE DEPARTMENT(DEPT_NO NUMBER(2,2),DEPT_LOC VARCHAR2(10));
ADD COLUMN DEPT_NO TO JOB.
DISPLAY JOBID,DEPTNO,DEPTLOC;
ADD VALUES TO DEPARTMENT.
AS SELECT DEPT_NO FROM EMPLOYEE;
JOB_ID
DEPT_NO
IT_PGR
MK_MGR
FI_MGR
FI_ACC
LES
COM_OP

10
30
20
25
35
40

RAJKOT
AHMED
SOMNATH
JAMNAGAR
SURAT
VADODARA

-> ALTER TABLE JOB ADD(DEPT_NO NUMBER(2,2));


-> SELECT JOB.JOB_ID,JOB.DEPT_NO,DEPARTMENT.DEPT_LOC FROM JOB,DEPARTMENT WHERE
JOB.DEPT_NO=DEPARTMENT.DEPT_NO;
6TH Write a query to display the employee name, department number for all emplo
yees who work in SOMNATH.
-> SELECT EMPLOYEE.EMP_NAME,EMPLOYEE.DEPT_NO FROM EMPLOYEE,DEPARTMENT WHERE EMP
LOYEE.DEPT_NO=DEPARTMENT.DEPT_NO AND DEPT_LOC='SOMNATH';

UPDATE SET CNAME VALUES('ANIL');


INSERT INTO BRANCH (CNAME)
VALUES ('ANIL');
INSERT
VALUES
INSERT
VALUES
INSERT
VALUES
INSERT
VALUES
INSERT
VALUES

INTO BRANCH (CNAME)


('SUNIL');
INTO BRANCH (CNAME)
('MEHUL');
INTO BRANCH (CNAME)
('MADHURI');
INTO BRANCH (CNAME)
('PRAMOD');
INTO BRANCH (CNAME)
('SANDIP');

INSERT
VALUES
INSERT
VALUES
INSERT
VALUES

INTO BRANCH (CNAME)


('SHIVANI');
INTO BRANCH (CNAME)
('KRANTI');
INTO BRANCH (CNAME)
('MINU');

7TH Display the employee name and employee number along with their Label the
columns Employee ,Emp#, respectively.
->

SELECT EMPLOYEE.EMP_NAME "EMPLOYEE",EMPLOYEE.EMP_NO "EMP#" FROM EMPLOYEE;

8TH Create a query to display the name and hire date of any employee hired afte
r employee AMAN.
UPDATE EMPLOYEE SET HIRE_DATE='03-JAN-08' WHERE EMP_NO=101;
UPDATE EMPLOYEE SET HIRE_DATE='21-JUL-09' WHERE EMP_NO=102;
UPDATE EMPLOYEE SET HIRE_DATE='30-AUG-10' WHERE EMP_NO=103;
UPDATE EMPLOYEE SET HIRE_DATE='08-APR-11' WHERE EMP_NO=104;
UPDATE EMPLOYEE SET HIRE_DATE='01-DEC-12' WHERE EMP_NO=105;
UPDATE EMPLOYEE SET HIRE_DATE='04-MAY-13' WHERE EMP_NO=106;
UPDATE EMPLOYEE SET HIRE_DATE='08-JUN-14' WHERE EMP_NO=107;

-> SELECT EMPLOYEE.EMP_NAME "EMPLOYEE",EMPLOYEE.HIRE_DATE "HIREDATE" FROM EMPL


OYEE WHERE HIRE_DATE>'08-APR-11';

**************************GTU-6*********************************
SELECT SUM(AMOUNT) FROM DEPOSIT WHERE ADATE>'1-JAN-96';
SELECT SUM(DEPOSIT.AMOUNT) FROM DEPOSIT,CUSTOMERS WHERE DEPOSIT.CNAME=CUSTOMERS.
CNAME AND CUSTOMERS.CITY='NAGPUR';
SELECT MAX(AMOUNT) FROM DEPOSIT,CUSTOMERS WHERE DEPOSIT.CNAME=CUSTOMERS.CNAME AN
D CUSTOMERS.CITY='BOMBAY';
SELECT ROUND(MAX(EMP_SAL)) MAXIMUM,ROUND(MIN(EMP_SAL)) MINIMUM,ROUND(SUM(EMP_SAL
)) SUM_SAL,ROUND(AVG(EMP_SAL)) AVERAGE FROM EMPLOYEE;
SELECT MAX(EMP_SAL)-MIN(EMP_SAL) "DIFFERENCE" FROM EMPLOYEE;

SELECT (SELECT COUNT(*) FROM EMPLOYEE) TOTAL,(SELECT COUNT(*) FROM EMPLOYEE WHER
E TO_CHAR(HIRE_DATE,'YYYY')='2009') "2009",(SELECT COUNT(*) FROM EMPLOYEE WHERE
TO_CHAR(HIRE_DATE,'YYYY')='2010') "2010",(SELECT COUNT(*) FROM EMPLOYEE WHERE TO
_CHAR(HIRE_DATE,'YYYY')='2012') "2012",(SELECT COUNT(*) FROM EMPLOYEE WHERE TO_C
HAR(HIRE_DATE,'YYYY')='2014') "2014" FROM DUAL;

SELECT (SELECT AVG(EMP_SAL) FROM EMPLOYEE WHERE DEPT_NO='10'),(SELECT AVG(EMP_SA


L) FROM EMPLOYEE WHERE DEPT_NO='20'),(SELECT AVG(EMP_SAL) FROM EMPLOYEE WHERE DE
PT_NO='30') FROM EMPLOYEE;
OR
SELECT AVG(EMP_SAL) FROM EMPLOYEE GROUP BY DEPT_NO;

SELECT SUM(EMP_SAL) FROM EMPLOYEE,JOB WHERE EMPLOYEE.DEPT_NO=JOB.DEPT_NO GROUP


BY JOB_TITLE;
SELECT AVG(EMP_SAL) FROM EMPLOYEE GROUP BY DEPT_NO HAVING AVG(EMP_SAL)>2000;

SELECT ((MIN_SAL+MAX_SAL)/2) "TOTAL SAL" FROM JOB;


SELECT JOB_ID,((MIN_SAL+MAX_SAL)/2) "TOTAL_SAL" FROM JOB WHERE (((MIN_SAL+MAX_S
AL)/2)>3000) ORDER BY TOTAL_SAL;
SELECT SUM(EMP_SAL) "TOTAL_SAL",DEPT_NO FROM EMPLOYEE WHERE SUM(EMP_SAL)>3000 OR
DER BY TOTAL_SAL;

select deposit.bname from deposit,branch where deposit.bname=branch.bname and (


deposit.amount)>5000 and branch.city='BOMBAY';
*******************************PRACTICE-PRACTICAL-5*********************
create table salesmen(snum varchar2(6) primary key,sname varchar2(20) NOT NULL,c
ity varchar2(15),comm number(5,2),check(snum like 'S%'));
insert into salesman values('S1001','Piyush','London','0.12');
insert into salesman values('S1002','Niraj','San jose','0.13');
insert into salesman values('S1003','Miti','London','0.11');
insert into salesman values('S1004','Rajesh','Barcelona','0.15');
insert into salesman values('S1005','Haresh','New york','0.10');
insert into salesman values('S1006','Ram','Bombay','0.10');
insert into salesman values('S1007','Nehal','Delhi','0.09');
create table customer(cnum varchar2(6) primary key,cname varchar2(20) NOT NULL,c
ity varchar2(15),rating number(5),snum varchar2(6),check(cnum like 'C%'));
insert into customer values('C2001','Hardik','London','100','S1001');
insert into customer values('C2002','Geeta','Rome','200','S1003');
insert into customer values('C2003','Kavish','San jose','200','S1002');
insert into customer values('C2004','Dhruv','Berlin','300','S1002');
insert into customer values('C2005','Pratham','London','100','S1001');

insert into customer values('C2006','Vyomesh','San jose','300','S1007');


insert into customer values('C2007','Kirit','Rome','100','S1004');
create table orders(onum varchar2(6) primary key,amt number(10,2) NOT NULL,odate
date,cnum varchar2(6),snum varchar2(6),check(onum like 'O%'));
insert into orders values('O3001','18.69','10-Mar-90','C2008','S1007');
insert into orders values('O3003','767.19','10-Mar-90','C2001','S1001');
insert into orders values('O3002','1900.10','03-Oct-90','C2007','S1004');
insert into orders values('O3005','5160.45','04-Oct-90','C2003','S1002');
insert into orders values('O3006','1098.16','10-Mar-90','C2008','S1007');
insert into orders values('O3009','1713.23','10-April-90','C2002','S1003');
insert into orders values('O3007','75.75','10-April-90','C2004','S1002');
insert into orders values('O3008','4723.00','10-May-90','C2006','S1001');
insert into orders values('O3010','1309.95','10-May-90','C2004','S1002');
insert into orders values('O3011','9891.88','10-June-90','C2006','S1001');
1. Display all the information of salesmen.
==> select * from salesman;
2. Display snum,sname,city from salesmen table.
==> select snum,sname,city from salesman;
3. Display odate,snum,onum and amt from orders.
==> select odate,snum,onum,amt from orders;
4. Display the information of orders without duplication.
==> select distinct * from orders;
5. List of sname, city from salesmen where city is

LONDON .

==> select sname,city from salesman where city='London';


6. List all records of customers where rating is equal to 100.
==> select * from customer where rating=100;
7. Write a select command that produces the order number,amount and date for all
rows in the order table.
==> select onum,amt,odate from orders;
8. Produces all rows from the customer table for which the salesperson s number is
S1001.
==> select * from customer where snum='S1001';
9. Display the salesperson table with the column in the following order:
city,sname,snum,comm.
==> select city,sname,snum,comm from salesman;
SELECT RATING,CNAME FROM CUSTOMER WHERE CITY='San jose';

SELECT DISTINCT SNUM FROM SALESMEN;


*********OPERATORS************
SELECT * FROM CUSTOMER WHERE RATING>200;
SELECT * FROM CUSTOMER WHERE CITY='San jose' AND RATING>200;
SELECT * FROM CUSTOMER WHERE CITY='San jose' OR RATING>200;
SELECT * FROM CUSTOMER WHERE CITY='San jose' OR RATING<200;
SELECT * FROM CUSTOMER WHERE NOT CITY='San jose' OR RATING<200;
SELECT * FROM ORDERS WHERE AMT>1000;
SELECT SNAME,CITY FROM SALESMEN WHERE CITY='London' AND COMM>.10;
SELECT * FROM CUSTOMER WHERE RATING>100 AND CITY!='Rome';
SELECT * FROM CUSTOMER WHERE SNUM IN('S1001','S1007','S1004');
SELECT * FROM SALESMEN WHERE CITY IN('Barcelona','London');
SELECT * FROM SALESMEN WHERE COMM>.10 AND COMM<.12;
SELECT * FROM CUSTOMER WHERE CNAME IN('%A%','%G%');
SELECT * FROM CUSTOMER WHERE CNAME LIKE 'G%';
SELECT * FROM SALESMEN WHERE SNAME LIKE 'P%h';
SELECT * FROM CUSTOMER WHERE CITY IS NULL;
SELECT * FROM ORDERS WHERE ODATE IN('03-OCT-90','04-OCT-90');
SELECT * FROM ORDERS WHERE ODATE BETWEEN '03-OCT-90' AND '04-OCT-90';
SELECT * FROM CUSTOMER WHERE SNUM IN('S1001','S1002');
select * from customer WHERE cname LIKE 'A%' or cname LIKE 'B%' or cname LIKE 'C
%' or cname LIKE 'D%' or cname LIKE 'E%' or cname LIKE 'F%' or cname LIKE 'G%' o
r cname LIKE 'H%';
SELECT * FROM CUSTOMER WHERE CNAME LIKE '%C';
SELECT * FROM ORDERS WHERE AMT IS NOT NULL;
SELECT SUM(AMT),AVG(AMT) FROM ORDERS;
SELECT COUNT( DISTINCT SNUM) FROM ORDERS;
SELECT COUNT(RATING) FROM CUSTOMER WHERE RATING IS NULL;
SELECT COUNT(RATING) FROM CUSTOMER WHERE RATING IS NOT NULL;
SELECT MAX(AMT) FROM ORDERS GROUP BY SNUM;

SELECT MAX(AMT) FROM ORDERS GROUP BY SNUM,ODATE;


***********************************************GTU-7****************************
CREATE TABLE EMPLOYEES (EMPLOYEE_ID VARCHAR2(10),FIRST_NAME VARCHAR2(20),LAST_NA
ME VARCHAR2(20),EMAIL VARCHAR2(20),PHONE_NUMBER VARCHAR2(20),HIRE_DATE DATE,JOB_
ID VARCHAR2(20),SALARY NUMBER(10,2),COMMISSION_PCT NUMBER(10,2),MANAGER_ID NUMB
ER(10,2),DEPARTMENT_ID NUMBER(10,2));

CREATE TABLE LOCATIONS(location_id VARCHAR2(12),street_address VARCHAR2(30),post


al_code VARCHAR2(20),city VARCHAR2(20),state_province VARCHAR2(30),country_id VA
RCHAR2(5));

CREATE TABLE JOBS(JOB_ID VARCHAR2(12),JOB_TITLE VARCHAR2(35),MIN_SALARY NUMBER(8


,2),MAX_SALARY NUMBER(8,2));
CREATE TABLE DEPARTMENTS(DEPARTMENT_ID NUMBER(10,2),DEPARTMENT_NAME VARCHAR2(20)
,MANAGER_ID NUMBER(10,2),LOCATION_ID NUMBER(10,2));

************************EMPLOYEES******************
INSERT INTO EMPLOYEES VALUES('100','STEVEN','KING','SKING','515.123.4567','17-JU
N-87','AD_PRES','24000','0','0','90');
INSERT INTO EMPLOYEES VALUES('101','NEENA','KOCHHAR','NKOCHHAR','515.123.4568','
18-JUN-87','AD_VP','17000','0','100','90');
INSERT INTO EMPLOYEES VALUES('102','LEX','DE HAAN','LDEHAAN','515.123.4569','19JUN-87','AD_VP','17000','0','100','90');
INSERT INTO EMPLOYEES VALUES('103','ALEXANDER','HUNOLD','AHUNOLD','590.423.4567'
,'20-JUN-87','IT_PROG','9000','0','102','60');
INSERT INTO EMPLOYEES VALUES('104','BRUCE','ERNST','BERNST','590.423.4568','21-J
UN-87','IT_PROG','6000','0','103','60');
INSERT INTO EMPLOYEES VALUES('105','DAVID','AUSTIN','DAUSTIN','590.423.4569','22
-JUN-87','IT_PROG','4800','0','103','60');
INSERT INTO EMPLOYEES VALUES('106','VALLI','PATABALLA','VPATABAL','590.423.4560'
,'23-JUN-87','IT_PROG','4800','0','103','60');
INSERT INTO EMPLOYEES VALUES('107','DIANA','LORENTZ','DLORENTZ','590.423.5567','
24-JUN-87','IT_PROG','4200','0','103','60');
INSERT INTO EMPLOYEES VALUES('108','NANCY','GREENBERG','NGREENBE','515.124.4569'
,'25-JUN-87','FI_MGR','12000','0','101','100');
INSERT INTO EMPLOYEES VALUES('109','DANIEL','FAVIET','DFAVIET','515.124.4169','2
6-JUN-87','FI_ACCOUNT','9000','0','108','100');
INSERT INTO EMPLOYEES VALUES('110','JOHN','CHEN','JCHEN','515.124.4269','27-JUN87','FI_ACCOUNT','8200','0','108','100');
INSERT INTO EMPLOYEES VALUES('111','ISMAEL','SCIARRA','ISCIARRA','515.124.4369',
'28-JUN-87','FI_ACCOUNT','7700','0','108','100');
INSERT INTO EMPLOYEES VALUES('112','JOSE MANUEL','URMAN','JMURMA','515.124.4469'
,'29-JUN-87','FI_ACCOUNT','7800','0','108','100');
INSERT INTO EMPLOYEES VALUES('113','LUIS','POPP','LPOPP','515.124.4567','30-JUN87','FI_ACCOUNT','6900','0','108','100');

INSERT INTO EMPLOYEES VALUES('114','DEN','RAPHAELY','DRAPHEAL','515.127.4561','7


-JAN-87','PU_MAN','11000','0','100','30');
INSERT INTO EMPLOYEES VALUES('115','ALEXANDER','KHOO','AKHOO','515.127.4562','7FEB-87','PU_CLERK','3100','0','114','30');
INSERT INTO EMPLOYEES VALUES('116','SHELLI','BAIDA','SBAIDA','515.127.4563','7-M
AR-87','PU_CLERK','2900','0','114','30');
INSERT INTO EMPLOYEES VALUES('117','SIGAL','TOBIAS','STOBIAS','515.127.4564','7APR-87','PU_CLERK','2800','0','114','30');
INSERT INTO EMPLOYEES VALUES('118','GUY','HIMURO','GHIMURO','515.127.4565','7-MA
Y-87','PU_CLERK','2600','0','114','30');
INSERT INTO EMPLOYEES VALUES('119','KAREN','COLMENARES','KCOLMENA','515.127.4566
','7-JUN-87','PU_CLERK','2500','0','114','30');
INSERT INTO EMPLOYEES VALUES('120','MATTHEW','WEISS','MWEISS','650.123.1234','7JUL-87','ST_MAN','8000','0','100','50');
INSERT INTO EMPLOYEES VALUES('121','ADAM','FRIPP','AFRIP','650.123.2234','8-JUN1987','ST_MAN','8200','0','100','50');
INSERT INTO EMPLOYEES VALUES('122','PAYAM','KAUFLING','PKAUFLING','650.123.3234'
,'9-JUN-1987','ST_MAN','7900','0','100','50');
INSERT INTO EMPLOYEES VALUES('123','SHANTA','VOLLMAN','SVOLLMAN','650.123.4234',
'10-JUN-1987','ST_MAN','6500','0','100','50');
INSERT INTO EMPLOYEES VALUES('124','KEVIN','MOURGOS','KMOURGOS','650.123.5234','
11-JUN-1987','ST_MAN','5800','0','100','50');
INSERT INTO EMPLOYEES VALUES('125','JULIA','ERNST','BERNST','650.124.1214','21-J
UN-87','ST_CLERK','3200','0','120','50');
INSERT INTO EMPLOYEES VALUES('126','IRENE','MIKKILINENI','IMIKKILI','650.124.122
4','13-JUN-1987','ST_CLERK','2700','0','120','50');
INSERT INTO EMPLOYEES VALUES('127','JAMES','LANDRY','JLANDRY','650.124.1334','14
-JUN-1987','ST_CLERK','2400','0','120','50');
INSERT INTO EMPLOYEES VALUES('128','STEVEN','MARKLE',',SMARKLE','650.124.1434','
15-JULY-87','ST_CLERK',2200,0,120,50);
INSERT INTO EMPLOYEES VALUES('129','LAURA','BISSOT','LBISSOT','650.124.5234','16
-JULY-87','ST_CLERK',3300,0,121,50);
INSERT INTO EMPLOYEES VALUES('130','MOZHE','ATKINSON','MATKINSO','650.124.6234',
'17-JULY-87','ST_CLERK',2800,0,121,50);
INSERT INTO EMPLOYEES VALUES('131','JAMES','MARLOW','JAMRLOW','650.124.7234','18
-JULY-87','ST_CLERK',2500,0,121,50);
INSERT INTO EMPLOYEES VALUES('132','TJ','OLSON','TJOLSON','650.124.8234','19-JUL
Y-87','ST_CLERK',2100,0,121,50);
INSERT INTO EMPLOYEES VALUES('133','JASON','MALLIN','JMALLIN','650.127.1934','20
-JULY-87','ST_CLERK',3300,0,122,50);
INSERT INTO EMPLOYEES VALUES('134','MICHAEL','ROGERS','MROGERS','650.127.1834','
21-JULY-87','ST_CLERK',2900,0,122,50);
INSERT INTO EMPLOYEES VALUES('135','KI','GEE','KGEE','650.127.1734','22-JUL-87',
'ST_CLERK','2400','0','122','50');
INSERT INTO EMPLOYEES VALUES('136','HAZEL','PHILTANKER','HPHILTAN','650.127.1634
','23-JUL-87','ST_CLERK','2200','0','122','50');
INSERT INTO EMPLOYEES VALUES('137','RENSKE','LADWIG','RLADWIG','650.121.1234','2
4-JUL-87','ST_CLERK','3600','0','123','50');
INSERT INTO EMPLOYEES VALUES('138','STEPHEN','STILES','SSTILES','650.121.2034','
25-JUL-87','ST_CLERK','3200','0','123','50');
INSERT INTO EMPLOYEES VALUES('139','JOHN','SEO','JSEO','650.121.2019','26-JUL-87
','ST_CLERK','2700','0','123','50');
INSERT INTO EMPLOYEES VALUES('140','JOSHUA','PATEL','JPATEL','650.121.1834','27JUL-87','ST_CLERK','2500','0','123','50');
INSERT INTO EMPLOYEES VALUES('141','TRENNA','RAJS','TRAJS','650.121.8009','28-JU
L-87','ST_CLERK','3500','0','124','50');
INSERT INTO EMPLOYEES VALUES('142','CURTIS','DAVIES','CDAVIES','650.121.2994','2
9-JUL-87','ST_CLERK','3100','0','124','50');
INSERT INTO EMPLOYEES VALUES('143','RANDALL','MATOS','RMATOS','650.121.2874','30
-JUL-87','ST_CLERK','2600','0','124','50');

INSERT INTO EMPLOYEES VALUES('144','PETER','VARGAS','PVARGAS','650.121.2004','31


-JUL-87','ST_CLERK','2500','0','124','50');
INSERT INTO EMPLOYEES VALUES('145','JOHN','RUSSELL','JRUSSEL','011.44.1344.42926
8','1-AUG-87','SA_MAN','14000','0.4','100','80');
INSERT INTO EMPLOYEES VALUES('146','KAREN','PARTNERS','KPARTNER','011.44.1344.46
7268','1-AUG-87','SA_MAN','13500','0.3','100','80');
INSERT INTO EMPLOYEES VALUES('147','ALBERTO','ERRAZURIZ','AERRAZUR','011.44.1344
.429278','3-AUG-87','SA_MAN','12000','0.3','100','80');
INSERT INTO EMPLOYEES VALUES('148','GERALD','CAMBRAULT','GCAMBRAU','011.44.1344.
619268','4-AUG-87','SA_MAN','11000','0.3','100','80');
INSERT INTO EMPLOYEES VALUES ('149','ELENI','ZLOTKEY','EZLOTKEY','011.44.1344.42
9018','5-AUG-87','SA_MAN','10500','0.2','100','80');
INSERT INTO EMPLOYEES VALUES ('150','PETER','TUCKER','PTUCKER','011.44.1344.1292
68','6-AUG-87','SA_REP','10000','0.3','145','80');
INSERT INTO EMPLOYEES VALUES ('151','DAVID','BERNSTEIN','DBERNSTE','011.44.1344.
345268','7-AUG-87','SA_REP','9500','0.25','145','80');
INSERT INTO EMPLOYEES VALUES ('152','PETER','HALL','PHALL','011.44.1344.478968',
'8-AUG-87','SA_REP','9000','0.25','145','80');
INSERT INTO EMPLOYEES VALUES ('153','CHRISTOPHER','OLSEN','COLSEN','011.44.1344.
498718','9-AUG-87','SA_REP','8000','0.2','145','80');
INSERT INTO EMPLOYEES VALUES ('154','NANETTE','CAMBRAULT','NCAMBRAU','011.44.134
4.987668','10-AUG-87','SA_REP','7500','0.2','145','80');
INSERT INTO EMPLOYEES VALUES ('155','OLIVER','TUVAULT','OTUVAULT','011.44.1344.4
86508','11-AUG-87','SA_REP','7000','0.15','145','80');
INSERT INTO EMPLOYEES VALUES('156','JANETTE','KING','JKING','011.44.1345.429268'
,'12-AUG-87','SA_REP','10000','0.35','146','80');
INSERT INTO EMPLOYEES VALUES('157','PATRICK','SULLY','PSULLY','011.44.1345.92926
8','13-AUG-87','SA_REP','9500','0.35','146','80');
INSERT INTO EMPLOYEES VALUES('158','ALLAN','MCEWEN','AMCEWEN','011.44.1345.82926
8','14-AUG-87','SA_REP','9000','0.35','146','80');
INSERT INTO EMPLOYEES VALUES('159','LINDSEY','SMITH','LSMITH','011.44.1345.72926
8','15-AUG-87','SA_REP','8000','0.3','146','80');
INSERT INTO EMPLOYEES VALUES('160','LOUISE','DORAN','LDORAN','011.44.1345.629268
','16-AUG-87','SA_REP','7500','0.3','146','80');
INSERT INTO EMPLOYEES VALUES('161','SARATH','SEWALL','SSEWALL','011.44.1345.5292
68','17-AUG-87','SA_REP','7000','0.25','146','80');
INSERT INTO EMPLOYEES VALUES('162','CLARA','VISHNEY','CVISHNEY','011.44.1346.129
268','18-AUG-87','SA_REP','10500','0.25','147','80');
INSERT INTO EMPLOYEES VALUES('163','DANIELLE','GREENE','DGREENE','011.44.1346.22
9268','19-AUG-1987','SA_REP','9500','0.15','147','80');
INSERT INTO EMPLOYEES VALUES('164','MATTEA','MARVINS','MMARVINS','011.44.1346.32
9268','20-AUG-1987','SA_REP','7200','0.1','147','80');
INSERT INTO EMPLOYEES VALUES('165','DAVID','LEE','DLEE','011.44.1346.529268','21
-AUG-1987','SA_REP','6800','0.1','147','80');
INSERT INTO EMPLOYEES VALUES('166','SUNDAR','ANDE','SANDE','011.44.1346.629268',
'22-AUG-1987','SA_REP','6400','0.1','147','80');
INSERT INTO EMPLOYEES VALUES('167','AMIT','BANDA','ABANDA','011.44.1346.729268',
'23-AUG-1987','SA_REP','6200','0.1','147','80');
INSERT INTO EMPLOYEES VALUES('168','LISA','OZER','LOZER','011.44.1343.929268','2
4-AUG-1987','SA_REP','11500','0.25','148','80');
INSERT INTO EMPLOYEES VALUES('169','HARRISON','BLOOM','HBLOOM','011.44.1343.8292
68','25-AUG-1987','SA_REP','10000','0.2','148','80');
INSERT INTO EMPLOYEES VALUES('170','TAYLER','FOX','TFOX','011.44.1343.729268','2
6-AUG-87','SA_REP','9600','0.2','148','80');
INSERT INTO EMPLOYEES VALUES('171','WILLIAM','SMITH','WSMITH','011.44.1343.62926
8','27-AUG-87','SA_REP','7400','0.15','148','80');
INSERT INTO EMPLOYEES VALUES('172','ELIZABETH','BATES','EBATES','011.44.1343.529
268','28-AUG-87','SA_REP','7300','0.15','148','80');
INSERT INTO EMPLOYEES VALUES('173','SUNDITA','KUMAR','SKUMAR','011.44.1343.32926
8','29-AUG-87','SA_REP','6100','0.1','148','80');

INSERT INTO EMPLOYEES VALUES('174','ELLEN','ABEL','EABEL','011.44.1644.429267','


30-AUG-87','SA_REP','11000','0.3','149','80');
INSERT INTO EMPLOYEES VALUES('175','ALYSSA','HUTTON','AHUTTON','011.44.1644.4292
66','31-AUG-87','SA_REP','8800','0.25','149','80');
INSERT INTO EMPLOYEES VALUES('176','JONATHON','TAYLOR','JTAYLOR','011.44.1644.42
9265','1-SEP-87','SA_REP','8600','0.2','149','80');
INSERT INTO EMPLOYEES VALUES('177','JACK','LIVINGSTON','JLIVINGS','011.44.1644.4
29264','9-FEB-87','SA_REP','8400','0.2','149','80');
INSERT INTO EMPLOYEES VALUES('178','KIMBERELY','GRANT','KURANT','011.44.1644.429
263','9-MAR-87','SA_REP','7000','0.15','149','0');
INSERT INTO EMPLOYEES VALUES('179','CHARLES','JOHNSON','CJOHNSON','011.44.1644.4
29262','9-APRIL-87','SA_REP','6200','0.1','149','80');
INSERT INTO EMPLOYEES VALUES('180','WINSTON','TAYLOR','WTAYLOR','650.507.9876','
9-MAY-87','SA_CLERK','3200','0','120','50');
INSERT INTO EMPLOYEES VALUES('181','JEAN','FLEAUR','JFLEAUR','650.507.9877','9-J
UN-87','SA_CLERK','3100','0','120','50');
INSERT INTO EMPLOYEES VALUES('182','MARTHA','SULLIVAN','MSULLIVA','650.507.9878'
,'9-JULY-87','SA_CLERK','2500','0','120','50');
INSERT INTO EMPLOYEES VALUES('183','GIRARD','GEONI','GGEONI','650.507.9879','9-A
UG-87','SA_CLERK','2800','0','120','50');
INSERT INTO EMPLOYEES VALUES('184','NANDITA','SARCHAND','NSARCHAN','650.509.1876
','9-SEP-1987','SH_CLERK','4200','0','121','50');
INSERT INTO EMPLOYEES VALUES('185','ALEXIS','BULL','ABULL','650.509.2876','10-SE
P-1987','SH_CLERK','4100','0','121','50');
INSERT INTO EMPLOYEES VALUES('186','JULIA','DELLINGER','JDELLING','650.509.3876'
,'11-SEP-1987','SH_CLERK','3400','0','121','50');
INSERT INTO EMPLOYEES VALUES('187','ANTHONY','CABRIO','ACABRIO','650.509.4876','
12-SEP-1987','SH_CLERK','3000','0','121','50');
INSERT INTO EMPLOYEES VALUES('188','KELLY','CHUNG','KCHUNG','650.505.1876','13-S
EP-1987','SH_CLERK','3800','0','122','50');
INSERT INTO EMPLOYEES VALUES('189','JENNIFER','DILLY','JDILLY','650.505.2876','1
4-SEP-1987','SH_CLERK','3600','0','122','50');
INSERT INTO EMPLOYEES VALUES('190','TIMOTHY','GATES','TGATES','650.505.3876','15
-SEP-1987','SH_CLERK','2900','0','122','50');
INSERT INTO EMPLOYEES VALUES('191','RANDALL','PERKINS','RPERKINS','650.505.4876'
,'16-SEP-1987','SH_CLERK',2500,0,122,50);
INSERT INTO EMPLOYEES VALUES('192','SARAH','BELL','SBELL','650.501.1876','17-SEP
-1987','SH_CLERK',4000,0,123,50);
INSERT INTO EMPLOYEES VALUES('193','BRITNEY','EVERETT','BEVERETT','650.501.2876'
,'18-SEP-1987','SH_CLERK',3900,0,123,50);
INSERT INTO EMPLOYEES VALUES('194','SAMUEL','MCCAIN','SMCCAIN','650.501.3876','1
9-SEP-1987','SH_CLERK',3200,0,123,50);
INSERT INTO EMPLOYEES VALUES('195','VANCE','JONES','VJONES','650.501.4876','20-S
EP-1987','SH_CLERK',2800,0,123,50);
INSERT INTO EMPLOYEES VALUES('196','ALANA','WALSH','AWALSH','650.507.9811','21-S
EP-1987','SH_CLERK',3100,0,124,50);
INSERT INTO EMPLOYEES VALUES('197','KEVIN','FEENEY','KFEENEY','650.507.9822','22
-SEP-1987','SH_CLERK',3000,0,124,50);
INSERT INTO EMPLOYEES VALUES('198','DONALD','OCONNELL','DOCONNEL','650.507.9833'
,'23-SEP-1987','SH_CLERK',2600,0,124,50);
INSERT INTO EMPLOYEES VALUES('199','DOUGLAS','GRANT','DGRANT','650.507.9844','24
-SEP-1987','SH_CLERK',2600,0,124,50);
INSERT INTO EMPLOYEES VALUES('200','JENNIFER','WHALEN','JWHALEN','515.123.4444',
'25-SEP-1987','AD_ASST',4400,0,101,10);
INSERT INTO EMPLOYEES VALUES('201','MICHAEL','HARTSTEIN','MHARTSTE','515.123.555
5','26-SEP-1987','MK_MAN',13000,0,100,20);
INSERT INTO EMPLOYEES VALUES('202','PAT','FAY','PFAY','603.123.6666','27-SEP-198
7','MK_REP',6000,0,201,20);
INSERT INTO EMPLOYEES VALUES('203','SUSAN','MAVRIS','SMAVRIS','515.123.7777','28
-SEP-1987','HR_REP',6500,0,101,40);

INSERT INTO EMPLOYEES VALUES('204','HERMANN','BAER','HBAER','515.123.8888','29-S


EP-1987','PR_REP',10000,0,101,70);
INSERT INTO EMPLOYEES VALUES('205','SHELLEY','HIGGINS','SHIGGINS','515.123.8080'
,'30-SEP-1987','AC_MGR',12000,0,101,110);
INSERT INTO EMPLOYEES VALUES('206','WILLIAM','GIETZ','WGIETZ','515.123.8181','1OCT-1987','AC_ACCOUNT',8300,0,205,110);

*************************************LOCATIONS**********************************
***********************

INSERT INTO LOCATIONS VALUES('1000','1297 VIA COLA DI RIE','989','ROMA','','IT')


;
INSERT INTO LOCATIONS VALUES('1100','93091 CALLE DELLA TE','10934','VENICE','','
IT');
INSERT INTO LOCATIONS VALUES('1200','2017 SHINJUKU-KU','1689','TOKYO','TOKYO PRE
FECTU','JP');
INSERT INTO LOCATIONS VALUES('1300','9450 KAMIYA-CHO','6823','HIROSHIMA','','JP'
);
INSERT INTO LOCATIONS VALUES('1400','2014 JABBERWOCKY RD','26192','SOUTHLAKE','T
EXAS','US');
INSERT INTO LOCATIONS VALUES('1500','2011 INTERIORS BLVD','99236','SOUTH SAN','C
ALIFORNIA','US');
INSERT INTO LOCATIONS VALUES('1600','2007 ZAGORA ST','50090','SOUTH BRUN','NEW J
ERSEY','US');
INSERT INTO LOCATIONS VALUES('1700','2004 CHARADE RD','98199','SEATTLE','WASHING
TON','US');
INSERT INTO LOCATIONS VALUES('1800','147 SPADINA AVE','M5V 2L7','TORONTO','ONTAR
IO','CA');
INSERT INTO LOCATIONS VALUES('1900','6092 BOXWOOD ST','YSW 9T2','WHITEHORSE','YU
KON','CA');
INSERT INTO LOCATIONS VALUES('2000','40-5-12LAOGIANGGEN','190518','BEIJING','','
CN');
INSERT INTO LOCATIONS VALUES('2100','1298VILEPARLE (E)','490231','BOMBAY','MAHA
RASHTRA','IN');
INSERT INTO LOCATIONS VALUES('2200','12-98 VICTORIA STREE','2901','SYDNEY','NEW
SOUTH WALE','AU');
INSERT INTO LOCATIONS VALUES('2300','198 CLEMENTI NORTH','540198','SINGAPORE','
','SG');
INSERT INTO LOCATIONS VALUES('2400','8204 ARTHUR ST','','LONDON','','UK');

INSERT INTO LOCATIONS VALUES('2500','MAGDALEN CENTRE, THE','OX9 9ZB','OXFORD','


OXFORD','UK');
INSERT INTO LOCATIONS VALUES('2600','9702 CHESTER ROAD','9629850293','STRETFORD'
,'MANCHESTER','UK');
INSERT INTO LOCATIONS VALUES('2700','SCHWANTHALERSTR. 703','80925','MUNICH','BA
VARIA','DE');
INSERT INTO LOCATIONS VALUES('2800','RUA FREI CANECA 1360','01307-002','SAO PAU
LO','SAO PAULO','BR');
INSERT INTO LOCATIONS VALUES('2900','20 RUE DES CORPS-SAI','1730','GENEVA','GEN
EVE','CH');
INSERT INTO LOCATIONS VALUES('2900','20 RUE DES CORPS-SAI','1730','GENEVA','GEN
EVE','CH');
INSERT INTO LOCATIONS VALUES('3000','MURTENSTRASSE 921','3095','BERN','BE','CH'
);
INSERT INTO LOCATIONS VALUES('3100','PIETER BREUGHELSTRAA','3029SK','UTRECHT','
UTRECHT','NL');
INSERT INTO LOCATIONS VALUES('3200','MARIANO ESCOBEDO 999','11932','MEXICO CIT'
,'DISTRITO FEDER','MX');

*********************************************JOBS*************************

INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT

INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO

JOBS
JOBS
JOBS
JOBS
JOBS
JOBS
JOBS
JOBS
JOBS
JOBS
JOBS
JOBS
JOBS
JOBS
JOBS
JOBS
JOBS
JOBS
JOBS

VALUES('AD_PRES','President',20000,40000);
VALUES('AD_VP','Administration Vice President',15000,30000);
VALUES('AD_ASST','Administration Assistant',3000,6000);
VALUES('FI_MGR','Finance Manager',8200,16000);
VALUES('FI_ACCOUNT','Accountant',4200,9000);
VALUES('SA_MAN','Sales Manager',10000,20000);
VALUES('SA_REP','Sales Representative',6000,12000);
VALUES('PU_MAN','Purchasing Manager',8000,15000);
VALUES('PU_CLERK','Purchasing Clerk',2500,5500);
VALUES('ST_MAN','Stock Manager',5500,8500);
VALUES('ST_CLERK','Stock Clerk',2000,5000);
VALUES('SH_CLERK','Shipping Clerk',2500,5500);
VALUES('IT_PROG','Programmer',4000,10000);
VALUES('MK_MAN','Marketing Manager',9000,15000);
VALUES('MK_REP','Marketing Representative',4000,9000);
VALUES('HR_REP','Human Resources Representative',4000,9000);
VALUES('PR_REP','Public Relations Representative',4500,10500);
VALUES('AC_ACCOUNT','Public Accountant',4200,9000);
VALUES('AC_MGR','Accounting Manager',8200,16000);

************************************DEPARTMENTS**********************
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT

INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO

DEPARTMENTS
DEPARTMENTS
DEPARTMENTS
DEPARTMENTS
DEPARTMENTS
DEPARTMENTS
DEPARTMENTS
DEPARTMENTS
DEPARTMENTS
DEPARTMENTS
DEPARTMENTS
DEPARTMENTS
DEPARTMENTS
DEPARTMENTS
DEPARTMENTS
DEPARTMENTS
DEPARTMENTS
DEPARTMENTS
DEPARTMENTS
DEPARTMENTS
DEPARTMENTS
DEPARTMENTS
DEPARTMENTS
DEPARTMENTS
DEPARTMENTS
DEPARTMENTS
DEPARTMENTS

VALUES(10,'ADMINISTRATION',200,1700);
VALUES(20,'MARKETING',201,1800);
VALUES(30,'PURCHASING',114,1700);
VALUES(40,'HUMAN RESOURCES',203,2400);
VALUES(50,'SHIPPING',121,1500);
VALUES(60,'IT',103,1400);
VALUES(70,'PIBLIC RELATIONS',204,2700);
VALUES(80,'SALES',145,2500);
VALUES(90,'EXECUTIVE',100,1700);
VALUES(100,'FINANCE',108,1700);
VALUES(110,'ACCOUNTING',205,1700);
VALUES(120,'TREASURY',0,1700);
VALUES(130,'CORPORATE TAX',0,1700);
VALUES(140,'CONTROL AND CREDIT',0,1700);
VALUES(150,'SHAREHOLDER SERVICES',0,1700);
VALUES(160,'BENEFITS',0,1700);
VALUES(170,'MANUFACTURING',0,1700);
VALUES(180,'CONSTRUCTION',0,1700);
VALUES(190,'CONTRACTING',0,1700);
VALUES(200,'OPERATIONS',0,1700);
VALUES(210,'IT SUPPORT',0,1700);
VALUES(220,'NOC',0,1700);
VALUES(230,'IT HELPDESK',0,1700);
VALUES(240,'GOVERNMENT SALES',0,1700);
VALUES(250,'RETAIL SALES',0,1700);
VALUES(260,'RECRUITING',0,1700);
VALUES(270,'PAYROLL',0,1700);

You might also like