Ism F
Ism F
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
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:
DEPTNO NUMBER 2
DNAME TEXT 10
LOC TEXT 10
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:
PNO Number 2
PNAME Text 10
PTYPE Text 15
BUDGET Number 8
70 LG ELECTRONICS 750000
75 HP ELECTRONICS 350000
OUTPUT
INPUT
Assignment No. 4
1. In the EMP Table, increase the size of ENAME from 10 to 15.
Table altered.
2. In the EMP Table, add field Ph_no with data type number and size 10.
4. Update PROJECT table and for PNO 65, enter budget as 90000 instead of 82000
5. Update EMP table and give 10% salary hike to all employees.
Assignment No. 5
Q1) Create Table Client_Master
UPDATE CLIENT_MASTER
SET CITY='BANGALORE'
WHERE CLIENT_NO='C00005';
UPDATE CLIENT_MASTER
SET BALDUE=1000
WHERE CLIENT_NO='C00001';
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;
TABLE DELETED.
Assignment No. 6
Q1) Alter table EMP, set EMPNO as Primary Key.
Q7) Create Table Student described below defining constraint at column level with constraint
names:
Assignment No. 8
1. Create course table with given constraints
AMIT KUMAR GUPTA 14061101719 BBA4F
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
Assignment No. 10
1. Create students table having following structure and constraints
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
Assignment No. 13
Length,Upper,Lower,Reverse,Concat,strcmp, locate, Insert ,left,right
Chinese
Alphabet
Ravish
SANDEEP
MANISH
AMIT KUMAR GUPTA 14061101719 BBA4F
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("foot", "footpath") AS MatchPosition;
Badminton ,mint
Toothbrush, brush
Racingcar, car
Hillarious, us
Something,thin
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
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
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
Q3. Find the Department Name and total no of employees working in each department
A)
B)
AMIT KUMAR GUPTA 14061101719 BBA4F
C)
D)
AMIT KUMAR GUPTA 14061101719 BBA4F
Assignment No. 16
CONCEPT USED: UPDATE
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
F)
RESULT
AMIT KUMAR GUPTA 14061101719 BBA4F
Assignment No. 20
CONCEPT USED: UPDATE
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
Q2: After creation of the Table, Insert the following Data as Shown Below
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
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
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
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
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
QUESTIONS
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
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
QUESTIONS
AMIT KUMAR GUPTA 14061101719 BBA4F
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
QUESTION
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
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
Q2.CREATE THE FOLLOWING TABLE AND THEN INSERT THE DATA ACORDINGLY BY LINKING
WITH ABOVE PRODUCT TABLE
QUESTIONS
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.
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
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.