You are on page 1of 3

1ST-------

create table CUSTOMER (CustID NUBER(2), FName VARCHAR2(15), LName VARCHAR2(15),


Phone NUMBER, Sales NUMBER, Address VARCHAR2(20);

INSERT INTO CUSTOMER VALUES (1, 'Ajay', 'Batra', 27111333, 1810, 'Rohini');

INSERT INTO CUSTOMER VALUES (2, 'Deepak', 'Chopra', 25656891, 7388 ,'Ashok
Vihar' );

INSERT INTO CUSTOMER VALUES (3, 'Rajesh', 'Mehta', 23455511, 13578, 'Ashok Vihar');

INSERT INTO CUSTOMER VALUES (4, 'Priya Kumar', 23456334, 14825, 'Rohini');

INSERT INTO CUSTOMER VALUES (5, 'Ramit', 'Arya', 24567565, 10065, 'Model Town');

INSERT INTO CUSTOMER VALUES (6, 'Arpit', 'Jain', 23222334, 2806, 'Shailmar Bagh');

INSERT INTO CUSTOMER VALUES (7, 'Rahul', 'Kundra', 24567856, 1305, 'Model Town');

INSERT INTO CUSTOMER VALUES (8, 'Kisan', 'Kumar', 27898981, 9149 ,'Town hall');

INSERT INTO CUSTOMER VALUES (9, 'Rahul', 'Singh', 28911436, 8500, 'Rohini');

INSERT INTO CUSTOMER VALUES (10,'Manish', 'Tripati', 25974621, 4975, 'Ashok


Vihar');

2ND--------

ALTER TABLE CUSTOMER ADD PINCODE NUMBER(6);

3RD-----

Update CUSTOMER set PINCODE =615432 WHERE ADDRESS ='Rohini';

Update CUSTOMER set PINCODE =632475 WHERE ADDRESS = 'Model Town';

Update CUSTOMER set PINCODE =669914 WHERE ADDRESS = 'Ashok Vihar';

insert into customer (CUSTID,PINCODE) VALUES (6,NULL);

4TH------- Select all the information of employee of Rohini area

SELECT * FROM customer WHERE ADDRESS = 'Rohini';

5th----Change the phone no. as 27111343 where phone number is 27111333

Update CUSTOMER set Phone= 27111343 WHERE phone = 27111333 ;

6th-----Display the data for Arpit, Rahul and Kisan. Ans:

select * from customer where FName IN ( 'Arpit','Rahul','Kisan');

7th--------Display record on the basis of Fnam

select FName,Lname,Phone,Sales,Address from customer;

8th----- Display all of records from customer table


select * from customer;

9th----------- Display the records whose sales between 5000 to 10000

select * from customer where Sales between 5000 and 10000;

10TH---Display the records whose address is having �Town�

SELECT * FROM CUSTOMER WHERE Address = 'Model Town';

11th------ Display the records whose address is rohini and sales > 5000 Ans: ?

select * from customer where Address = 'Rohini' and Sales>5000;

12TH------ Display the records except Ashok Vihar Address Ans:

SELECT * FROM CUSTOMER WHERE Address not IN ('Ashok Vihar');

13th------Display the records where 'a' is the 2nd char in their last name Ans: ?

select * from customer where LName like '_a%';

14th----Display the whose pincode is blank Ans: ?

select FNAME,PINCODE from customer where PINCODE IS NULL;

15th----Delete only sale value for Manish Tripati Ans: ?

UPDATE CUSTOMER SET Sales is NULL WHERE FName = 'Manish';

16th-------- Delete the rows where the address is Rohini. Ans:

delete from customer where Address = 'Rohini';

17TH -----Create a duplicate customer table without DATA

CERATE TABLE CS1 AS CUSTOMER WHERE 0=1;

You might also like