0% found this document useful (0 votes)
174 views128 pages

Ism F

The document describes 4 assignments involving creating and populating tables in a database: 1. Create an EMP table and insert employee data. 2. Create a DEPT table and insert department data. 3. Create a PROJECT table and insert project data. 4. Modify the ENAME field in the EMP table to increase its size.

Uploaded by

Amit Gupta
Copyright
© © All Rights Reserved
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% found this document useful (0 votes)
174 views128 pages

Ism F

The document describes 4 assignments involving creating and populating tables in a database: 1. Create an EMP table and insert employee data. 2. Create a DEPT table and insert department data. 3. Create a PROJECT table and insert project data. 4. Modify the ENAME field in the EMP table to increase its size.

Uploaded by

Amit Gupta
Copyright
© © All Rights Reserved
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
You are on page 1/ 128

AMIT KUMAR GUPTA 14061101719 BBA4F

Assignment No. 1
1. Create a table EMP with the following fields:
Field Name Field Type Size

EMPNO Number 4

ENAME Text 10

JOB Text 10

HIREDATE Date

SAL Number 4

2. Insert the following data in the EMP table:


EMPNO ENAME JOB HIREDATE SAL

7369 SMITH CLERK 17-DEC-80 800

7499 ALLEN SALESMAN 20-FEB-81 1600

7521 WARD SALESMAN 22-FEB-81 1250

7566 JONES MANAGER 02-APR-81 2975

7654 MARTIN SALESMAN 28-SEP-81 1250

7698 BLAKE MANAGER 01-MAY-81 2850

7782 CLARK MANAGER 09-JUN-81 2450

7788 SCOTT ANALYST 19-APR-87 3000

7839 KING PRESIDENT 17-NOV-81 5000

7844 TURNER SALESMAN 08-SEP-81 1500

7876 ADAMS CLERK 23-MAY-87 1100

7900 JAMES CLERK 03-DEC-81 950

7902 FORD ANALYST 03-DEC-81 3000

7934 MILLER CLERK 23-JAN-82 1300


AMIT KUMAR GUPTA 14061101719 BBA4F

OUTPUT
EMPNO ENAME JOB HIREDATE SAL
7369 SMITH CLERK 17-DEC-80 800
7499 ALLEN SALESMAN 20-FEB-81 1600
7521 WARD SALESMAN 22-FEB-81 1250
7566 JONES MANAGER 02-APR-81 2975
7654 MARTIN SALESMAN 28-SEP-81 1250
7698 BLAKE MANAGER 01-MAY-81 2850
7782 CLARK MANAGER 09-JUN-81 2450
7839 KING PRESIDENT 17-NOV-81 5000
7844 TURNER SALESMAN 08-SEP-81 1500
7900 JAMES CLERK 03-DEC-81 950
7902 FORD ANALYST 03-DEC-81 3000
7934 MILLER CLERK 23-JAN-82 1300
7788 SCOTT ANALYST 19-APR-87 3000
7876 ADAMS CLERK 23-MAY-87 1100

INPUT VALUES
create table EMP(EMPNO NUMBER(4),ENAME VARCHAR(10),JOB VARCHAR(10),HIREDATE
DATE,SAL NUMBER(4))
insert into emp values('7369','SMITH','CLERK','17-DEC-80','800');
insert into emp values('7499','ALLEN','SALESMAN','20-FEB-81','1600');
insert into emp values('7521','WARD','SALESMAN','22-FEB-81','1250');
insert into emp values('7566','JONES','MANAGER','02-APR-81','2975');
insert into EMP values('7654','MARTIN','SALESMAN','28-SEP-81','1250');
insert into EMP values('7698','BLAKE','MANAGER','01-MAY-81','2850');
select * from emp;
insert into EMP values('7782','CLARK','MANAGER','09-JUN-81','2450')
insert into EMP values('7788','SCOTT',' ANALYST','19-APR-87','3000')
insert into EMP values('7839','KING','PRESIDENT','17-NOV-81','5000')
insert into EMP values('7844','TURNER','SALESMAN','08-SEP-81','1500')
insert into EMP values('7876','ADAMS','CLERK','23-MAY-87','1100')
insert into EMP values('7900','JAMES','CLERK','03-DEC-81','950')
insert into EMP values('7902','FORD','ANALYST','03-DEC-81','3000')
insert into EMP values('7934','MILLER','CLERK','23-JAN-82','1300')
select * from emp

Assignment No. 2
1. Create a table DEPT with the following fields:

Field Name Field Type Size


AMIT KUMAR GUPTA 14061101719 BBA4F

DEPTNO NUMBER 2

DNAME TEXT 10

LOC TEXT 10

2. Insert the following data in the DEPT table:

DEPTNO DNAME LOC

10 ACCOUNTING NEW YORK

20 RESEARCH DALLAS

30 SALES CHICAGO

40 OPERATIONS BOSTON

OUTPUT
DEPTNO DNAME LOC
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON

INPUT VALUES
CREATE TABLE DEPT(DEPTNO NUMBER(2),DNAME VARCHAR(10),LOC VARCHAR(10))
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');
SELECT * FROM DEPT

Assignment No. 3
1. Create a table PROJECT with the following fields:

Field Name Field Type Size


AMIT KUMAR GUPTA 14061101719 BBA4F

PNO Number 2

PNAME Text 10

PTYPE Text 15

BUDGET Number 8

2. Insert the following data in the PROJECT table:

PNO PNAME PTYPE BUDGET

10 DLF REAL ESTATE 123456

20 BILT PAPER 4500000

30 SAMSUNG ELECTRONICS 4560000

40 ERRICSONS ELECTRONICS 67000

50 AMARPALLI REAL ESTATE 670000

60 RAHEJA REAL ESTATE 750000

70 LG ELECTRONICS 750000

80 VIDEOCON ELECTRONICS 90000

15 LUXOR PAPER 15000

25 CLASSMATE PAPER 250000

35 NATRAJ PAPER 35000

45 APSARA PAPER 45000

65 DELL ELECTRONICS 82000

75 HP ELECTRONICS 350000

OUTPUT

PNO PNAME PTYPE BUDGET


10 DLF REAL ESTATE 123456
20 BILT PAPER 4500000
AMIT KUMAR GUPTA 14061101719 BBA4F

30 SAMSUNG ELECTRONICS 4560000


40 ERRICSONS ELECTRONICS 67000
50 AMARPALLI REAL ESTATE 670000
60 RAHEJA REAL ESTATE 750000
70 LG ELECTRONICS 750000
80 VIDEOCON ELECTRONICS 90000
15 LUXOR PAPER 15000
25 CLASSMATE PAPER 250000
35 NATRAJ PAPER 35000
45 APSARA PAPER 45000
65 DELL ELECTRONICS 82000
75 HP ELECTRONICS 350000

INPUT

CREATE TABLE PROJECT(PNO Number(2),PNAME VARCHAR(10),PTYPE VARCHAR(15),BUDGET


Number(8))
INSERT INTO PROJECT VALUES('10','DLF','REAL ESTATE','123456')
INSERT INTO PROJECT VALUES('20','BILT','PAPER','4500000')
INSERT INTO PROJECT VALUES('30','SAMSUNG','ELECTRONICS','4560000')
INSERT INTO PROJECT VALUES('40','ERRICSONS','ELECTRONICS','67000')
INSERT INTO PROJECT VALUES('50','AMARPALLI','REAL ESTATE','670000')
INSERT INTO PROJECT VALUES('60','RAHEJA','REAL ESTATE','750000')
INSERT INTO PROJECT VALUES('70','LG','ELECTRONICS','750000')
INSERT INTO PROJECT VALUES('80','VIDEOCON','ELECTRONICS','90000')
INSERT INTO PROJECT VALUES('15','LUXOR','PAPER','15000')
INSERT INTO PROJECT VALUES('25','CLASSMATE','PAPER','250000')
INSERT INTO PROJECT VALUES('35','NATRAJ','PAPER','35000')
INSERT INTO PROJECT VALUES('45','APSARA','PAPER','45000')
INSERT INTO PROJECT VALUES('65','DELL','ELECTRONICS','82000')
INSERT INTO PROJECT VALUES('75','HP','ELECTRONICS','350000')
SELECT * FROM PROJECT

Assignment No. 4
1. In the EMP Table, increase the size of ENAME from 10 to 15.

SELECT * FROM EMP


ALTER TABLE EMP MODIFY ENAME VARCHAR(15)
AMIT KUMAR GUPTA 14061101719 BBA4F

Table altered.

2. In the EMP Table, add field Ph_no with data type number and size 10.

ALTER TABLE EMP ADD PH_NO NUMBER(10)

EMPNO ENAME JOB HIREDATE SAL PH_NO


7369 SMITH CLERK 17-DEC-80 800 -
7499 ALLEN SALESMAN 20-FEB-81 1600 -
7521 WARD SALESMAN 22-FEB-81 1250 -
7566 JONES MANAGER 02-APR-81 2975 -
7654 MARTIN SALESMAN 28-SEP-81 1250 -
9782 LARK MANAGER 09-MAY-81 550 -
9782 LARK MANAGER 09-MAY-81 50 -
7698 BLAKE MANAGER 01-MAY-81 2850 -
7782 CLARK MANAGER 09-JUN-81 2450 -
7839 KING PRESIDENT 17-NOV-81 5000 -
7844 TURNER SALESMAN 08-SEP-81 1500 -
7900 JAMES CLERK 03-DEC-81 950 -
7902 FORD ANALYST 03-DEC-81 3000 -
7934 MILLER CLERK 23-JAN-82 1300 -
7788 SCOTT ANALYST 19-APR-87 3000 -
7876 ADAMS CLERK 23-MAY-87 1100 -

3. Update EMP table and add data for Ph_no field.

SELECT * FROM EMP


UPDATE EMP SET PH_NO='9990585791' WHERE EMPNO=7369
UPDATE EMP SET PH_NO='9990585792' WHERE EMPNO=7499
UPDATE EMP SET PH_NO='9990585793' WHERE EMPNO=7521
UPDATE EMP SET PH_NO='9990585794' WHERE EMPNO=7566
UPDATE EMP SET PH_NO='9990585795' WHERE EMPNO=7654
UPDATE EMP SET PH_NO='9990585796' WHERE EMPNO=9782
UPDATE EMP SET PH_NO='9990585797' WHERE EMPNO=9782
UPDATE EMP SET PH_NO='9990585798' WHERE EMPNO=7698
UPDATE EMP SET PH_NO='9990585799' WHERE EMPNO=7782
UPDATE EMP SET PH_NO='9990585700' WHERE EMPNO=7839
UPDATE EMP SET PH_NO='9990585701' WHERE EMPNO=7844
UPDATE EMP SET PH_NO='9990585702' WHERE EMPNO=7900
UPDATE EMP SET PH_NO='9990585703' WHERE EMPNO=7902
UPDATE EMP SET PH_NO='9990585704' WHERE EMPNO=7934
UPDATE EMP SET PH_NO='9990585705' WHERE EMPNO=7788
AMIT KUMAR GUPTA 14061101719 BBA4F

UPDATE EMP SET PH_NO='9990585706' WHERE EMPNO=7876


SELECT * FROM EMP

EMPNO ENAME JOB HIREDATE SAL PH_NO


7369 SMITH CLERK 17-DEC-80 800 9990585791
7499 ALLEN SALESMAN 20-FEB-81 1600 9990585792
7521 WARD SALESMAN 22-FEB-81 1250 9990585793
7566 JONES MANAGER 02-APR-81 2975 9990585794
7654 MARTIN SALESMAN 28-SEP-81 1250 9990585795
9782 LARK MANAGER 09-MAY-81 550 9990585797
9782 LARK MANAGER 09-MAY-81 50 9990585797
7698 BLAKE MANAGER 01-MAY-81 2850 9990585798
7782 CLARK MANAGER 09-JUN-81 2450 9990585799
7839 KING PRESIDENT 17-NOV-81 5000 9990585700
7844 TURNER SALESMAN 08-SEP-81 1500 9990585701
7900 JAMES CLERK 03-DEC-81 950 9990585702
7902 FORD ANALYST 03-DEC-81 3000 9990585703
7934 MILLER CLERK 23-JAN-82 1300 9990585704
7788 SCOTT ANALYST 19-APR-87 3000 9990585705
7876 ADAMS CLERK 23-MAY-87 1100 9990585706

4. Update PROJECT table and for PNO 65, enter budget as 90000 instead of 82000

SELECT * FROM PROJECT


UPDATE PROJECT SET BUDGET=90000 WHERE PNO=65;
SELECT * FROM PROJECT

PNO PNAME PTYPE BUDGET


10 DLF REAL ESTATE 123456
20 BILT PAPER 4500000
30 SAMSUNG ELECTRONICS 4560000
40 ERRICSONS ELECTRONICS 67000
50 AMARPALLI REAL ESTATE 670000
60 RAHEJA REAL ESTATE 750000
70 LG ELECTRONICS 750000
80 VIDEOCON ELECTRONICS 90000
15 LUXOR PAPER 15000
25 CLASSMATE PAPER 250000
35 NATRAJ PAPER 35000
45 APSARA PAPER 45000
65 DELL ELECTRONICS 90000
75 HP ELECTRONICS 350000
AMIT KUMAR GUPTA 14061101719 BBA4F

5. Update EMP table and give 10% salary hike to all employees.

SELECT * FROM EMP


UPDATE EMP SET SAL=1.1*800 WHERE EMPNO=7369
UPDATE EMP SET SAL=1.1*1600 WHERE EMPNO=7499
UPDATE EMP SET SAL=1.1*1250 WHERE EMPNO=7521
UPDATE EMP SET SAL=1.1*2975 WHERE EMPNO=7566
UPDATE EMP SET SAL=1.1*1250 WHERE EMPNO=7654
UPDATE EMP SET SAL=1.1*550 WHERE EMPNO=9782
UPDATE EMP SET SAL=1.1*50 WHERE EMPNO=9782
UPDATE EMP SET SAL=1.1*2850 WHERE EMPNO=7698
UPDATE EMP SET SAL=1.1*2450 WHERE EMPNO=7782
UPDATE EMP SET SAL=1.1*5000 WHERE EMPNO=7839
UPDATE EMP SET SAL=1.1*1500 WHERE EMPNO=7844
UPDATE EMP SET SAL=1.1*950 WHERE EMPNO=7900
UPDATE EMP SET SAL=1.1*3000 WHERE EMPNO=7902
UPDATE EMP SET SAL=1.1*1300 WHERE EMPNO=7934
UPDATE EMP SET SAL=1.1*3000 WHERE EMPNO=7788
UPDATE EMP SET SAL=1.1*1100 WHERE EMPNO=7876
SELECT * FROM EMP

EMPNO ENAME JOB HIREDATE SAL PH_NO


7369 SMITH CLERK 17-DEC-80 880 9990585791
7499 ALLEN SALESMAN 20-FEB-81 1760 9990585792
7521 WARD SALESMAN 22-FEB-81 1375 9990585793
7566 JONES MANAGER 02-APR-81 3273 9990585794
7654 MARTIN SALESMAN 28-SEP-81 1375 9990585795
9782 LARK MANAGER 09-MAY-81 55 9990585797
9782 LARK MANAGER 09-MAY-81 55 9990585797
7698 BLAKE MANAGER 01-MAY-81 3135 9990585798
7782 CLARK MANAGER 09-JUN-81 2695 9990585799
7839 KING PRESIDENT 17-NOV-81 5500 9990585700
7844 TURNER SALESMAN 08-SEP-81 1650 9990585701
7900 JAMES CLERK 03-DEC-81 1045 9990585702
7902 FORD ANALYST 03-DEC-81 3300 9990585703
7934 MILLER CLERK 23-JAN-82 1430 9990585704
7788 SCOTT ANALYST 19-APR-87 3300 9990585705
7876 ADAMS CLERK 23-MAY-87 1210 9990585706

6. Alter table EMP add field COMM Number (4).

ALTER TABLE EMP ADD COMM NUMBER(4)


AMIT KUMAR GUPTA 14061101719 BBA4F

SELECT * FROM EMP

EMPNO ENAME JOB HIREDATE SAL PH_NO COMM


7369 SMITH CLERK 17-DEC-80 880 9990585791 -
7499 ALLEN SALESMAN 20-FEB-81 1760 9990585792 -
7521 WARD SALESMAN 22-FEB-81 1375 9990585793 -
7566 JONES MANAGER 02-APR-81 3273 9990585794 -
7654 MARTIN SALESMAN 28-SEP-81 1375 9990585795 -
9782 LARK MANAGER 09-MAY-81 55 9990585797 -
9782 LARK MANAGER 09-MAY-81 55 9990585797 -
7698 BLAKE MANAGER 01-MAY-81 3135 9990585798 -
7782 CLARK MANAGER 09-JUN-81 2695 9990585799 -
7839 KING PRESIDENT 17-NOV-81 5500 9990585700 -
7844 TURNER SALESMAN 08-SEP-81 1650 9990585701 -
7900 JAMES CLERK 03-DEC-81 1045 9990585702 -
7902 FORD ANALYST 03-DEC-81 3300 9990585703 -
7934 MILLER CLERK 23-JAN-82 1430 9990585704 -
7788 SCOTT ANALYST 19-APR-87 3300 9990585705 -
7876 ADAMS CLERK 23-MAY-87 1210 9990585706 -

7. Update table EMP insert following values in the table.

UPDATE EMP SET COMM=300 WHERE EMPNO=7499


UPDATE EMP SET COMM=500 WHERE EMPNO=7521
UPDATE EMP SET COMM=1400 WHERE EMPNO=7654
UPDATE EMP SET COMM=0 WHERE EMPNO=7844
SELECT * FROM EMP

EMPNO ENAME JOB HIREDATE SAL PH_NO COMM


7369 SMITH CLERK 17-DEC-80 880 9990585791 -
7499 ALLEN SALESMAN 20-FEB-81 1760 9990585792 300
7521 WARD SALESMAN 22-FEB-81 1375 9990585793 500
7566 JONES MANAGER 02-APR-81 3273 9990585794 -
7654 MARTIN SALESMAN 28-SEP-81 1375 9990585795 1400
9782 LARK MANAGER 09-MAY-81 55 9990585797 -
7698 BLAKE MANAGER 01-MAY-81 3135 9990585798 -
7782 CLARK MANAGER 09-JUN-81 2695 9990585799 -
7839 KING PRESIDENT 17-NOV-81 5500 9990585700 -
7844 TURNER SALESMAN 08-SEP-81 1650 9990585701 0
7900 JAMES CLERK 03-DEC-81 1045 9990585702 -
7902 FORD ANALYST 03-DEC-81 3300 9990585703 -
7934 MILLER CLERK 23-JAN-82 1430 9990585704 -
AMIT KUMAR GUPTA 14061101719 BBA4F

7788 SCOTT ANALYST 19-APR-87 3300 9990585705 -


7876 ADAMS CLERK 23-MAY-87 1210 9990585706 -

8. Delete field Ph_no from EMP table.


ALTER TABLE EMP DROP COLUMN PH_NO
SELECT * FROM EMP
EMPNO ENAME JOB HIREDATE SAL COMM
7369 SMITH CLERK 17-DEC-80 880 -

7499 ALLEN SALESMAN 20-FEB-81 1760 300

7521 WARD SALESMAN 22-FEB-81 1375 500

7566 JONES MANAGER 02-APR-81 3273 -

7654 MARTIN SALESMAN 28-SEP-81 1375 1400

9782 LARK MANAGER 09-MAY-81 55 -

7698 BLAKE MANAGER 01-MAY-81 3135 -

7782 CLARK MANAGER 09-JUN-81 2695 -

7839 KING PRESIDENT 17-NOV-81 5500 -

7844 TURNER SALESMAN 08-SEP-81 1650 0

7900 JAMES CLERK 03-DEC-81 1045 -

7902 FORD ANALYST 03-DEC-81 3300 -

7788 SCOTT ANALYST 19-APR-87 3300 -

7876 ADAMS CLERK 23-MAY-87 1210 -

Assignment No. 5
Q1) Create Table Client_Master

CREATE TABLE CLIENT_MASTER(CLIENT_NO varchar(6),NAME varchar(20),CITY


varchar(15),PINCODE NUMBER(8), STATE VARCHAR(15) ,BALDUE number(10,2));

Q2) Insert the following data into the table

INSERT INTO CLIENT_MASTER VALUES('C00001','IVAN


BAYROSS','MUMBAI',400057,'MAHARASHTRA',15000);
INSERT INTO CLIENT_MASTER VALUES('C00002','MAMTA
MUZUMDAR','MADRAS',780001,'TAMIL NADU',0);
INSERT INTO CLIENT_MASTER VALUES('C00003','CHHAYA
BANKAR','MUMBAI',400057,'MAHARASHTRA',5000);
AMIT KUMAR GUPTA 14061101719 BBA4F

INSERT INTO CLIENT_MASTER VALUES('C00004','ASHWINI


JOSHI','BANGALORE',560001,'KARNATAKA',0);
INSERT INTO CLIENT_MASTER VALUES('C00005','HANSEL
COLACO','MUMBAI',400060,'MAHARASHTRA',2000);
INSERT INTO CLIENT_MASTER VALUES('C00006','DEEPAK
SHARMA','MANGALORE',560050,'KARNATAKA',0);
INSERT INTO CLIENT_MASTER VALUES('C00007','MANISH
JAIN','MANGALORE',560050,'KARNATAKA',7000);
INSERT INTO CLIENT_MASTER VALUES('C00008','KAVITA
NEGI','MADRAS',780001,'TAMIL NADU',6500);
SELECT * FROM CLIENT_MASTER;

Q3) Change the city of ClientNo ‘C00005’ to ‘Bangalore’.

UPDATE CLIENT_MASTER
SET CITY='BANGALORE'
WHERE CLIENT_NO='C00005';

Q4) Change the BalDue of ClientNo ‘C00001’ to Rs. 1000.

UPDATE CLIENT_MASTER
SET BALDUE=1000
WHERE CLIENT_NO='C00001';

Q5). Change the Pincode for ClientNo ‘C00005’ to ‘560063’.


AMIT KUMAR GUPTA 14061101719 BBA4F

UPDATE CLIENT_MASTER
SET PINCODE=560063
WHERE CLIENT_NO='C00005';

Q6). Delete from Client_Master where the column State holds the value ‘Tamil Nadu’.

UPDATE CLIENT_MASTER
SET STATE=' '
WHERE STATE='TAMIL NADU';

Q7). Delete from Client_Master where the column BalDue holds the value 0.

UPDATE CLIENT_MASTER
SET BALDUE=''
WHERE BALDUE=0;

Q8). Destroy the table Client_Master along with its data.


AMIT KUMAR GUPTA 14061101719 BBA4F

DROP TABLE CLIENT_MASTER

TABLE DELETED.

Assignment No. 6
Q1) Alter table EMP, set EMPNO as Primary Key.

ALTER TABLE emp


ADD CONSTRAINT PK_emp PRIMARY KEY(EMPNO);
AMIT KUMAR GUPTA 14061101719 BBA4F

Q2) Alter table DEPT, set DEPTNO as Primary Key.

ALTER TABLE dept


ADD CONSTRAINT PK_DEPT PRIMARY KEY (DEPTNO);

Q3) Alter table PROJECT, set PNO as Primary Key.

ALTER TABLE Project


ADD CONSTRAINT PK_Project PRIMARY KEY(PNO);
AMIT KUMAR GUPTA 14061101719 BBA4F

Q4) Create Table Client_Master.

CREATE TABLE CLIENT_MASTER(CLIENT_NO varchar(6),NAME varchar(20),CITY


varchar(15),BALDUE number(10,2), constraint PK_CLIENT PRIMARY KEY(CLIENT_NO));

Q5) Insert the following data into the table

INSERT INTO CLIENT_MASTER VALUES('C00001','IVAN BAYROSS','MUMBAI',15000);


INSERT INTO CLIENT_MASTER VALUES('C00002','MAMTA
MUZUMDAR','MADRAS',0);
AMIT KUMAR GUPTA 14061101719 BBA4F

INSERT INTO CLIENT_MASTER VALUES('C00003','CHHAYA


BANKAR','MUMBAI',5000);
INSERT INTO CLIENT_MASTER VALUES('C00004','ASHWINI JOSHI','BANGALORE',0);
INSERT INTO CLIENT_MASTER VALUES('C00005','HANSEL
COLACO','MUMBAI',2000);
SELECT * FROM CLIENT_MASTER;

Q6) Drop constraint from Client_Master table.


ALTER TABLE CLIENT_MASTER
DROP CONSTRAINT PK_CLIENT;

Q7) Create Table Student described below defining constraint at column level with constraint
names:

CREATE TABLE STUDENT(ROLL_NO NUMBER(4), NAME VARCHAR(20), CITY


VARCHAR(15), MARKS NUMBER(5,2) NOT NULL,
CONSTRAINT PK_STUDENT PRIMARY KEY(ROLL_NO),
CONSTRAINT UK_STUDENT UNIQUE (NAME))
AMIT KUMAR GUPTA 14061101719 BBA4F

Q8) Insert the following data into the table

INSERT INTO STUDENT VALUES(2001,'ADITYA NARANG','DELHI','75.67');


INSERT INTO STUDENT VALUES(2002,'MAMTA KOHLI','DELHI','80');
INSERT INTO STUDENT VALUES(2003,'CHAVI MEHTA','DELHI','50.45');
INSERT INTO STUDENT VALUES(2004,'ASHWINI JINDAL','DELHI','90.25');
INSERT INTO STUDENT VALUES(2005,'HARSHIT JAIN','DELHI','66.20');

Assignment No. 8
1. Create course table with given constraints
AMIT KUMAR GUPTA 14061101719 BBA4F

CREATE TABLE COURSE(COURSE_ID NUMBER(3),CNAME VARCHAR(30),FEES


NUMBER(10,2),PERCENTAGE NUMBER(3), FLOOR NUMBER(5), HOD VARCHAR(20));
ALTER TABLE COURSE
ADD CONSTRAINT PK_COURSE PRIMARY KEY(COURSE_ID);
ALTER TABLE COURSE
ADD CONSTRAINT CHK_COURSE CHECK(FEES>=’60000');
ALTER TABLE COURSE
ADD CONSTRAINT CHK_COURSE CHECK(FLOOR>=’1’ AND FLOOR<=’9’);

2. Insert following Values in course table

INSERT INTO COURSE VALUES(101,'BBA',75000,75,3,'DR. VIJAY');


INSERT INTO COURSE VALUES(102,'B.COM(H)',80000,80,8,'DR. MANJU');
INSERT INTO COURSE VALUES(103,'ECO(H)',85000,85,9,'DR.SANJAY');
INSERT INTO COURSE VALUES(104,'BJMC',65000,65,4,'DR. VINITA');
INSERT INTO COURSE VALUES(105,'BBA-LLB',70000,70,7,'DR. PRAVEEN');

Assignment No. 9
1. Create faculty table with given constraint.

To create a foreign key with reference from course table in the table
faculty, we first have to add a primary key in the course table.
AMIT KUMAR GUPTA 14061101719 BBA4F

ALTER TABLE COURSE


ADD CONSTRAINT PK_COURSE PRIMARY KEY(COURSE_ID);

CREATE TABLE FACULTY(FID NUMBER(3) ,FNAME VARCHAR(30) ,CO_ID


NUMBER(3) ,SPECIALISATION VARCHAR(30));
ALTER TABLE FACULTY
ADD CONSTRAINT PK_FAC PRIMARY KEY(FID);
ALTER TABLE FACULTY
MODIFY FNAME NOT NULL;
ALTER TABLE FACULTY
ADD CONSTRAINT FK_FAC FOREIGN KEY(CO_ID) REFERENCES COURSE(COURSE_ID);
ALTER TABLE FACULTY
ADD CONSTRAINT CHK_FAC CHECK(SPECIALISATION='IT, HR, FINANCE, MARKETING');

2. Insert following values in Faculty Table Data


INSERT INTO FACULTY VALUES(111,'DR. SARITA', 101, '')
INSERT INTO FACULTY VALUES(112,'DR. DEEPAK', 101, '')
INSERT INTO FACULTY VALUES(113,'DR. SANGEETA', 101, '')
INSERT INTO FACULTY VALUES(114,'DR.KAMNA', 102, '')
INSERT INTO FACULTY VALUES(115,'DR. UMESH', 103, '')
INSERT INTO FACULTY VALUES(116,'DR. DIKSHA', 104, '')

Assignment No. 10
1. Create students table having following structure and constraints

CREATE TABLE STUDENTS(ENROL_NO NUMBER(4), SNAME VARCHAR(30), DOB


DATE, CITY VARCHAR(30), CID NUMBER(3), MOBILE NUMBER(10),
CLASS_COORDINATOR NUMBER(3));
ALTER TABLE STUDENTS
ADD CONSTRAINT PK_STUDENTS PRIMARY KEY(ENROL_NO);
AMIT KUMAR GUPTA 14061101719 BBA4F

ALTER TABLE STUDENTS


MODIFY SNAME NOT NULL;
ALTER TABLE STUDENTS
ADD CONSTRAINT CHK_STUDENTS CHECK(DOB>='1-JAN-2000');
ALTER TABLE STUDENTS
MODIFY CITY DEFAULT 'DELHI'
ALTER TABLE STUDENTS
ADD CONSTRAINT FK_STUDENTS FOREIGN KEY(CID) REFERENCES
COURSE(COURSE_ID);
ALTER TABLE STUDENTS
ADD CONSTRAINT FK_STUDENTS FOREIGN KEY(CLASS_COORDINATOR)
REFERENCES FACULTY(FID);
ALTER TABLE STUDENTS
MODIFY MOBILE NOT NULL UNIQUE;

2. Insert Minimum 20 Values having Mix of different courses and class


Coordinator

INSERT INTO STUDENTS VALUES(1001,'SHRUTI', '2-FEB-2000', '', 102,565891,112)


INSERT INTO STUDENTS VALUES(1002,'SHUBHAM', '21-DEC-2001', 'MUMBAI',
104,535891,117)
INSERT INTO STUDENTS VALUES(1003,'TANYA', '14-MAR-2000', '', 105,565491,113)
INSERT INTO STUDENTS VALUES(1004,'ANMOL', '2-AUG-2000', '', 101,565691,111)
INSERT INTO STUDENTS VALUES(1005,'ANANYA', '11-FEB-2000', 'CHENNAI',
104,565861,114)
INSERT INTO STUDENTS VALUES(1006,'BHAVYA', '28-FEB-2001', 'BANGALORE',
103,562291,115)
INSERT INTO STUDENTS VALUES(1007,'DEV', '5-MAY-2000', '', 101,500091,117)
INSERT INTO STUDENTS VALUES(1008,'TUSHAR', '16-FEB-2000', '', 105,5655591,115)
INSERT INTO STUDENTS VALUES(1009,'SHREYA', '5-JUN-2000', 'MANGALORE',
103,565000,114)
INSERT INTO STUDENTS VALUES(1010,'TANMAY', '25-NOV-2000', '', 101,895891,111)
INSERT INTO STUDENTS VALUES(1011,'SNEHA', '5-FEB-2000', '', 104,565791,113)
INSERT INTO STUDENTS VALUES(1012,'MAYANK', '29-JULY-2001', '', 102,652891,116)
INSERT INTO STUDENTS VALUES(1013,'ADITI', '19-DEC-2000', 'AHMEDABAD',
102,565821,112)
INSERT INTO STUDENTS VALUES(1017,'DAKSH', '15-MAY-2000', '', 102,566391,112)
INSERT INTO STUDENTS VALUES(1018,'MANYA', '10-FEB-2000', '', 105,5964291,115)
INSERT INTO STUDENTS VALUES(1019,'ISHA', '2-AUG-2000','' , 102,515891,112)
AMIT KUMAR GUPTA 14061101719 BBA4F

INSERT INTO STUDENTS VALUES(1020,'SMRITI', '10-OCT-2001', 'CHANDIGARH',


104,56500081,116)

Assignment No. 11
CONCEPT USED : ORDER BY
Q1: Create the following Student table as per shown below
AMIT KUMAR GUPTA 14061101719 BBA4F

Q2: After creation of the Table, Insert the following Data as Shown Below

Q3.
 Display the student records in ascending order of name starting from A-Z
 Display the student records of all the female students in descending order
ranging from Z-A
AMIT KUMAR GUPTA 14061101719 BBA4F

 Display the Result of the students in Highest Total marks to the lowest Total
Marks.
 Display the Students records of all the male students ranging in Highest to lowest
marks in PDCS.
 Display the student records of all the female students ranging in lowest to
highest in ME.
 Display the students records in ascending order of ITM Marks.

A)

B)
AMIT KUMAR GUPTA 14061101719 BBA4F

C)

D)
AMIT KUMAR GUPTA 14061101719 BBA4F

E)

4)
AMIT KUMAR GUPTA 14061101719 BBA4F
AMIT KUMAR GUPTA 14061101719 BBA4F

Assignment No. 12
ABS, AVERAGE, COUNT, MAX,MIN,SQRT, MULT, DIV, ADD , SUB, POW

1. Find the Absolute value of the following Numbers


FUNCTION USED: ABS
AMIT KUMAR GUPTA 14061101719 BBA4F

2. Solve the Following queries using SQL AVERAGE FUCNTION


1. Find the average of the quantity ordered of the products from order details table.
2. Find the average price of all the products where supplier id is 1 and fetch the data from
table: products.
3. Find the average of the price of the products where supplier id is 1 and Category id is also
1.

3. Solve the following queries using COUNT Function


AMIT KUMAR GUPTA 14061101719 BBA4F

 Find the total no of the products as PRODUCT COUNT where supplier id is 1.


 Find the total no of the products as PRODUCT COUNT where category id is 2.
 Find the total no of customers from Customers table who lives in Mexico.
 Find the total no of suppliers belonging to USA.

4. Solve the following queries using Max and Min Function

 Find the minimum price value from products table.


 Find the Maximum Price value from products table.
 Find the name of the product having Minimum price.
 Find the ordered of various order from order details table where quantity ordered is minimum.
 Find the supplier id and category id from products table where price of the product is
maximum.
 Find order Id and Product Id of the products whose quantity is Minimum.
AMIT KUMAR GUPTA 14061101719 BBA4F
AMIT KUMAR GUPTA 14061101719 BBA4F
AMIT KUMAR GUPTA 14061101719 BBA4F

5. BASIC MATHEMATICAL FUNCTION

Function Used: SQRT, MULT, DIV, SUM, SUB, POW

 Find the square root of 64


 Find the square root of 81.
 Find the square root of 144.
 Divide 345/5
 Divide 567/4
 Divide 456/2
 Calculate 2 3
 Calculate 33
 TRUNCATE (234.567, 2)
 TRUNCATE (456.900, 1)
 TRUNCATE (567.90, 2)
 ADD 23, 45, 78;
 SUB 76, 23
 MULT 23, 56
AMIT KUMAR GUPTA 14061101719 BBA4F
AMIT KUMAR GUPTA 14061101719 BBA4F
AMIT KUMAR GUPTA 14061101719 BBA4F
AMIT KUMAR GUPTA 14061101719 BBA4F

Assignment No. 13
Length,Upper,Lower,Reverse,Concat,strcmp, locate, Insert ,left,right

Q1;Find the length of the following strings in SQL


 ALPBHABET
 SACHIN
 MR MANISH MITTAL
 MR.RISHABH
 VIKRAM_MITTAL@GMAIL.COM
AMIT KUMAR GUPTA 14061101719 BBA4F

Q2: Convert the Following cases of the below strings


FUNCTION USED : UPPER,LOWER

 Chinese
 Alphabet
 Ravish
 SANDEEP
 MANISH
AMIT KUMAR GUPTA 14061101719 BBA4F
AMIT KUMAR GUPTA 14061101719 BBA4F

Q3: Reverse the following strings


Function Used: Reverse
 Footpath
 Noon
 Eye
AMIT KUMAR GUPTA 14061101719 BBA4F

Q4:Concatenate the Following Strings and Make a concatenated String


Function Used: Concat

Suntax: SELECT CONCAT(&quot;OPP&quot;,&quot;IS&quot;) AS ConcatenatedString;


 MAIMS BBA FIRSTSEM SECA 1 as MAIMS/BBA/FIRSTSEM/SECA/1
 RAHUL MITTAL GMAIL.COM as Rahul.Mittal@Gmail.com
 SANDEEP SINGHAL as Sandeep.Singhal
AMIT KUMAR GUPTA 14061101719 BBA4F

Q5:Compare the two strings and return the result in form of 0/1
Function Used:STRCMP
 COMPUTER,COMPUTR
 FACEBOOK,FACEBKK
 AHYPG5048H,AHYPG5048H
 SANDEEPSINGHAL@GMAIL.COM,SANDEEPSINGHALGMAIL.COM
 MAIMS/BBA/SEM1/01113, MAIMS/BBA/SEM1/0113
AMIT KUMAR GUPTA 14061101719 BBA4F
AMIT KUMAR GUPTA 14061101719 BBA4F

Q6: Find the Position of the following substring in the main string.
SELECT LOCATE(&quot;foot&quot;, &quot;footpath&quot;) AS MatchPosition;
 Badminton ,mint
 Toothbrush, brush
 Racingcar, car
 Hillarious, us
 Something,thin
AMIT KUMAR GUPTA 14061101719 BBA4F

Q:7 ) INSERT FUNCTION IN SQL


AMIT KUMAR GUPTA 14061101719 BBA4F

Assignment No. 14
Q1 Create the following COURSE table as per shown below

Q2 After creation of the Table, Insert the following Data as Shown Below
AMIT KUMAR GUPTA 14061101719 BBA4F

Q3.Create the Following Table student admission which will store the information of the course
in which student has taken the admission

Q4 Insert the following Data in the table student admission


AMIT KUMAR GUPTA 14061101719 BBA4F

Assignment No. 15
Q1: Create the following Student table as per shown below

Q2: After creation of the Table, Insert the following Data as Shown Below
AMIT KUMAR GUPTA 14061101719 BBA4F

Q3.  Calculate Total as Sum of PDCS+ME+FA+ITM+HRM


 Find the max marks obtained in HRM
 Find the total no of students failing in HRM
 Find the name of the student who has got maximum marks in FA.
 Find the total no of students who has scored more than 75 in FA.
 Find the total no of female who are failing in PDCS
 Find the name of the student who has min marks in ME.

A)

B)

C)
AMIT KUMAR GUPTA 14061101719 BBA4F

D)

E)
AMIT KUMAR GUPTA 14061101719 BBA4F

F)

G)
AMIT KUMAR GUPTA 14061101719 BBA4F

H)

Assignment No. 16
AMIT KUMAR GUPTA 14061101719 BBA4F

Q1: create table employee

Q2: insert values into employee


AMIT KUMAR GUPTA 14061101719 BBA4F

Q3. Find the Department Name and total no of employees working in each department

 Find the City and total no of employees working in each city


 Find the total no of employees working as designation wise.
 Find the total no of female employees working in each department.
 Find the total no of male workers working in each city
AMIT KUMAR GUPTA 14061101719 BBA4F

A)

B)
AMIT KUMAR GUPTA 14061101719 BBA4F

C)

D)
AMIT KUMAR GUPTA 14061101719 BBA4F

Assignment No. 16
CONCEPT USED: UPDATE

Q1: Create the following Student table as per shown below

Q2:After creation of the Table,Insert the following Data as Shown Below


AMIT KUMAR GUPTA 14061101719 BBA4F

Q3.
 Give the Grace marks of 5 to all the students who are scoring marks between 35- 39 so that
they actually pass.
 Calculate Total as Sum of PDCS+ME+FA+ITM+HRM.
 Calculate Average as Total/ Total no of students.
 Calculate percentage of each student as (Total /500)*100.
 Allocate Grade as Following

A)
AMIT KUMAR GUPTA 14061101719 BBA4F

B)
AMIT KUMAR GUPTA 14061101719 BBA4F

C)

D)

E)
AMIT KUMAR GUPTA 14061101719 BBA4F
AMIT KUMAR GUPTA 14061101719 BBA4F

RESULT (B,C,D & E)


AMIT KUMAR GUPTA 14061101719 BBA4F

F)

RESULT
AMIT KUMAR GUPTA 14061101719 BBA4F

Assignment No. 20
CONCEPT USED: UPDATE

Q1: Create the following Student table as per shown below

Q2:After creation of the Table,Insert the following Data as Shown Below


AMIT KUMAR GUPTA 14061101719 BBA4F

Q3.
 Give the Grace marks of 5 to all the students who are scoring marks between 35- 39 so that
they actually pass.
 Calculate Total as Sum of PDCS+ME+FA+ITM+HRM.
 Calculate Average as Total/ Total no of students.
 Calculate percentage of each student as (Total /500)*100.
 Allocate Grade as Following

A)
AMIT KUMAR GUPTA 14061101719 BBA4F

B)

C)

D)

E)
AMIT KUMAR GUPTA 14061101719 BBA4F

TABLE E
AMIT KUMAR GUPTA 14061101719 BBA4F

F)
AMIT KUMAR GUPTA 14061101719 BBA4F
AMIT KUMAR GUPTA 14061101719 BBA4F

TABLE F

Assignment No. 21
CONCEPT USED: UPDATE

Q1: Create the following Student table as per shown below


AMIT KUMAR GUPTA 14061101719 BBA4F

Q2: After creation of the Table, Insert the following Data as Shown Below

1. Calculate Total Amount= Price*Quantity


2. Calculate Discounted Amount as == (Total Amount*Discount)/100
3. Calculate Final Amount= Total Amount- Discounted Amount

1.
AMIT KUMAR GUPTA 14061101719 BBA4F

2.
AMIT KUMAR GUPTA 14061101719 BBA4F

Q3)
AMIT KUMAR GUPTA 14061101719 BBA4F

Assignment No. 22
Function used UNION
1. CREATE A FOLLOWING TABLE SHOWING THE DETAILS OF THE STUDENTS
WHO HAVE PAID AMOUNT FOR THE ANNUAL TRIP
TABLE NAME: STUDENTA

2. INSERT THE FOLLOWING DATA IN THE TABLE

TABLE NAME: STUDENTB


AMIT KUMAR GUPTA 14061101719 BBA4F

TABLE NAME: STUDENTB


AMIT KUMAR GUPTA 14061101719 BBA4F

Question 1
 Find all the students from Section A, Section B,Section C Who has paid the amount for the trip
 Find all the students from Section A, Section B, Section C Who has not paid the amount for trip.
AMIT KUMAR GUPTA 14061101719 BBA4F

 Find all the female students from Section A, Section B,Section C Who has paid the amount for the
trip.
 Find all the male students from Section A, Section B,Section C Who has paid the amount for the trip
 Find all the female students from Section A, Section B,Section C Who has not paid the amount for
the trip
 Find all the male students from Section A, Section B,Section C Who has not paid the amount for the
Trip

1.

2)
AMIT KUMAR GUPTA 14061101719 BBA4F

3.

4.
AMIT KUMAR GUPTA 14061101719 BBA4F

5)

6)
AMIT KUMAR GUPTA 14061101719 BBA4F

Assignment No. 23
AMIT KUMAR GUPTA 14061101719 BBA4F

Function used UNION

1. CREATE A FOLLOWING TABLE SHOWING THE DETAILS OF CITIZENS WHO


GOT VACCINATED IN EAST DELHI

TABLE NAME : EASTDELHI

2. INSERT THE FOLLOWING DATA IN THE TABLE

TABLE NAME: WESTDELHI


AMIT KUMAR GUPTA 14061101719 BBA4F

TABLE NAME: NORTH DELHI


AMIT KUMAR GUPTA 14061101719 BBA4F

TABLE NAME: SOUTH DELHI


AMIT KUMAR GUPTA 14061101719 BBA4F

1. Question 1

 Find all the CITIZEN detail from ND,ED,WD,SD Who has been Vaccinated
 Find all the CITIZEN detail from ND,ED,WD,SD Who has been Vaccinated with Only Dose 1 and their
AMIT KUMAR GUPTA 14061101719 BBA4F

Dose2 is Pending.
 Find all the Female CITIZEN detail from ND,ED,WD,SD Who has been Vaccinated.
 Find all the CITIZEN detail from ND,ED,WD,SD Who has been Vaccinated with only Dose1 and their
Dose2 is Peding
 Find all the CITIZEN detail from ND,ED Who has been Vaccinated with only Dose1.
 Find all the CITIZEN detail from ND,ED,WD Who has been Vaccinated.
 Find all the CITIZEN detail from ED,WD,SD Who has been Vaccinated.

1.

2)
AMIT KUMAR GUPTA 14061101719 BBA4F

Q3)

Q4)
AMIT KUMAR GUPTA 14061101719 BBA4F

Q5)

Q6)
AMIT KUMAR GUPTA 14061101719 BBA4F

Q7)
AMIT KUMAR GUPTA 14061101719 BBA4F

Assignment No. 24
FUNCTION USED ALTER

1. Create a following table which will contain the detail of employees working in an
organisation and name of the table shall be employee details

2. Insert values into employee_details


AMIT KUMAR GUPTA 14061101719 BBA4F

3. ALTER TABLE EMPLOYEE_DETAILS ADD SALARY


AMIT KUMAR GUPTA 14061101719 BBA4F

3. After the column in added , update the data in that partilcuar column as

 update the salary of all the employees to 25000 woring in hr department as assistant .
 update the salary of all the employyes to 35000 working in hr department as manager.
 update the salary of all the employyes to 100000 working in finance department as director.
 update the salary of all the employees to 28000 working in finance department as assisatnt.
 update the salary of all the employees to 26000 working in sales department as assistant.
 update the salary of all the employees to 200000 working in sales departmet as ceo.
 update the salary of all the employees to 40000 working in sales department as manager.
 update the salary of all the employees to 45000 working in admin department as managAer.

(A)

(B)

RESULT A & B
AMIT KUMAR GUPTA 14061101719 BBA4F

(C)

(D)

RESULT C & D
AMIT KUMAR GUPTA 14061101719 BBA4F

(E)
(F)

(G)
AMIT KUMAR GUPTA 14061101719 BBA4F

(H)

RESULT E, F, G & H
AMIT KUMAR GUPTA 14061101719 BBA4F

Assignment No. 25
Function used DELETE

1. Create a following table showing the details of citizens who got vaccinated in east Delhi
TABLE NAME: EAST DELHI

2. INSERT THE FOLLOWING DATA IN THE TABLE


AMIT KUMAR GUPTA 14061101719 BBA4F

QUESTIONS

 Delete all the Citizens who has not got vaccinated at all.
 Delete all the citizens who has got the first dose of vaccination but has
not received the second dose.
 Delete all the female citizens from the table.
 Drop the table.
AMIT KUMAR GUPTA 14061101719 BBA4F

1.

2.

3.

4.
AMIT KUMAR GUPTA 14061101719 BBA4F

Assignment No. 26
Function used LIKE OPERATION

1. Create a following table which will contain the detail of employees working in an
organisation and name of the table shall be employee details

2. Insert the following data in the table


AMIT KUMAR GUPTA 14061101719 BBA4F

QUESTIONS

 Find the name of the employees whose name starts with R.


 Find the name of the employees ending with R.
 Find the name of the employees starting with P and ending with P.
 Find the name of the employees containing ee.
 Find the name of the employees containing “Ish” from second character place.
 Find the name of the male employees starting with R.
 Find the name of the female employees starting with I.
AMIT KUMAR GUPTA 14061101719 BBA4F

1.

2.

3.
AMIT KUMAR GUPTA 14061101719 BBA4F

4.

5.
AMIT KUMAR GUPTA 14061101719 BBA4F

6.

7.
AMIT KUMAR GUPTA 14061101719 BBA4F

Assignment No. 28
AMIT KUMAR GUPTA 14061101719 BBA4F

Function used AND, OR, NOT


1. Create a following table which will contain the detail of employees working in an
organisation and

Name of the table shall be employeedetails

2. Insert the following data in the table


AMIT KUMAR GUPTA 14061101719 BBA4F

QUESTIONS

 Find the name of employees who are working whose salary between 20000 and 50000.
 Find the name of employees who are having salary less than 50000.
 Find the name of the female employees who are working in HR department and salary is
between 100000 and 200000
 Find the name of the employees not working as Manager.
A)
AMIT KUMAR GUPTA 14061101719 BBA4F

B)

(C)
AMIT KUMAR GUPTA 14061101719 BBA4F

(D)

Assignment No. 31
AMIT KUMAR GUPTA 14061101719 BBA4F

CONCEPT USED : NESTED QUERIES

1. CREATE THE FOLLOWING TABLE – COURSE

TABLE1: COURSE TABLE

2. INSERT THE FOLLOWING DATE IN THIS TABLE

TABLE 2: STUDENT TABLE


AMIT KUMAR GUPTA 14061101719 BBA4F

QUESTIONS
AMIT KUMAR GUPTA 14061101719 BBA4F

 Find the name of the student studying in BBA course.


 Find the Roll, Name of the student studying in the BJMC course.
 Find the total no of the students studying in UG course.
 Find the total no of the students studying in PG course.

1.

2.
AMIT KUMAR GUPTA 14061101719 BBA4F

3.

4.
AMIT KUMAR GUPTA 14061101719 BBA4F

Assignment No. 32
Function used : CONCEPT USED
1. Create a following table department
AMIT KUMAR GUPTA 14061101719 BBA4F

TABLE 2: EMPLOYEE DETAILS


AMIT KUMAR GUPTA 14061101719 BBA4F

QUESTION

1. Find the name of employees who are working from Pune.


2. Find the name of employees who are having salary more than 15000 and are
working in Admin Department.
3. Find the name of the female employees who are working in HR department .
4. Find the total no of employees working as Female employee working in HR
department.
5. Find the total no of Male employees working in HR department.
6. Find the max salary of the employee working in HR Department,
7. Find the Name of the department and Total no of employees working in each
department.
8. Find the name of the employee who is having Minimum Salary.
9. Give the increment of Rs 5000 to all the employees of Finance Department.
10. Find the employees working as Manager in Admin department.

1.
AMIT KUMAR GUPTA 14061101719 BBA4F

2.

3.

4.

5.
AMIT KUMAR GUPTA 14061101719 BBA4F

6.

7.

8.
AMIT KUMAR GUPTA 14061101719 BBA4F

9.

Assignment No. 33
AMIT KUMAR GUPTA 14061101719 BBA4F

CONCEPT USED: UPDATE, LIMIT, SELECT


Q1: Create the following Student table as per shown below
AMIT KUMAR GUPTA 14061101719 BBA4F

QUESTION
 Calculate Total as Sum of ISM+ISMLAB+HRM+FM+RM+RMLAB
 Calculate percentage of each student as (Total /600)*100.
 FIND The top three students scoring HIGHEST in all subjects.
 Find the lowest 3 marks of the students in ISM subject.
 Find The total no of students who are failing in any one subject.
 Find the name of all the students who are passing in all the subjects.

1.
AMIT KUMAR GUPTA 14061101719 BBA4F

2.
AMIT KUMAR GUPTA 14061101719 BBA4F

3.
AMIT KUMAR GUPTA 14061101719 BBA4F

4.

5.

6.
AMIT KUMAR GUPTA 14061101719 BBA4F

Assignment No. 34
CONCEPT USED: NESTED QUERIES USING THREE TABLES

Q1: Create the following Product table as per shown below

PID VARCHAR(4) Primary Key


PNAME VARCHAR(10) Not Null
PRICE NUMBER(4) Not Null

PID PNAME PRICE


P01 BREAD 40
P02 BUTTER 45
P03 MILK 45
P04 JAM 65
P05 SUGAR 40
P06 OIL 90
P07 SALT 40
P08 RICE 80
P09 KETCHUP 80
P10 GHEE 450

Q2.CREATE THE FOLLOWING TABLE AND THEN INSERT THE DATA ACORDINGLY BY LINKING
WITH ABOVE PRODUCT TABLE

CID VARCHAR(3) PRIMARY KEY


CNAME VARCHAR(10) NOT NULL
CITY VARCHAR(10) NOT NULL
PIN NUMBER(6) NOT NULL
PID VARCHAR(4) FOREIGN KEY

CID CNAME CITY PIN PID


C01 RAVI DELHI 110034 P01
C02 VIKRAM MUMBAI 110087 P02
C03 SANDEEP PUNE 110038 P01
C04 VIRAAJ DELHI 110034 P01
C05 VATSAL MUMBAI 110087 P02
C06 RUCHIKA DELHI 110034 P02
C07 SAMEER DELHI 110034 P03
C08 SARITA PUNE 110038 P03
C09 DEEPAK PUNE 110038 P04
C10 DEEPTI MUMBAI 110087 P05
C11 KRITI DELHI 110034 P06
C12 RITU DELHI 110034 P07
C13 NEERU MUMBAI 110087 P08
C14 SANYA DELHI 110034 P09
C15 DEPU MUMBAI 110087 P10
AMIT KUMAR GUPTA 14061101719 BBA4F

3.CREATE THE FOLLOWING TABLE AND ENTER THE DATA ACCORDINGLY

ORDERID VARCHAR(4) PRIMARY KEY


DOO DATE NOT NULL
DOD DATE NOT NULL
CID VARCHAR(4) FOREIGN KEY
PAYMENTMODE VARCHAR(10
STATUS
ORDERID DOO DOD CID PAYMENTMODE STATUS
O01 12-APR-21 15-APR-21 C01 COD DELIVERED
O01 12-MAY-21 15-MAY-21 C02 PREPAID DELIVERED
O03 12-APR-21 15-APR-21 C03 COD DELIVERED
O04 12-MAY-21 15-MAY-21 C04 PREPAID DELIVERED
O05 12-APR-21 15-APR-21 C05 COD DELIVERED
O06 12-MAY-21 15-MAY-21 C06 PREPAID DELIVERED
O07 12-APR-21 15-APR-21 C07 COD DELIVERED
O08 12-MAY-21 15-MAY-21 C08 PREPAID DELIVERED
O09 12-APR-21 15-APR-21 C09 COD DELIVERED
O10 12-MAY-21 15-MAY-21 C10 PREPAID DELIVERED

QUESTIONS

1. Find the name of the product having minimum price.


AMIT KUMAR GUPTA 14061101719 BBA4F

2. Find the total no of customers who has ordered Bread.

3. Find the Name of the customers whose orders are not delivered.
AMIT KUMAR GUPTA 14061101719 BBA4F

4. Find the name of the customers who has paid for their orders.

5. Find the total no of orders from each city.

6. Find the name of the customers whose name starts with D.


AMIT KUMAR GUPTA 14061101719 BBA4F

7. Find the name of the customers whose name start with D and they have ordered Bread.

8. Find the name of the customers who has ordered products whose price is less than 100.
AMIT KUMAR GUPTA 14061101719 BBA4F

9. Find the order details which contain Bread in it.

10. Find the details of orders whose price is less than 50.
AMIT KUMAR GUPTA 14061101719 BBA4F

11. Find the details of the order where the product ordered has minimum price.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy