0% found this document useful (0 votes)
27 views7 pages

Assignment 6

Uploaded by

sai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views7 pages

Assignment 6

Uploaded by

sai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

ASSIGNMENT 6

1.CODE :
Create table Customer
(
Customerid Number(5),
CustomerName Number(10),
Address1 Varchar2(30),
Address2 Varchar2(30)
);
select * from Customer;
2. CODE :

ALTER TABLE Customer

Modify CustomerName Varchar2(30) not null;

3. CODE :
ALTER TABLE Customer
add
(Gender Varchar2(1),
Age Number(3),
PhoneNo Number(10));
select * from Customer;

4. CODE :
insert into customer VALUES(1000, 'ALLEN', '#115 Chicago', '#115 Chicago', 'M', 25,
7878776);
insert into customer VALUES(1001, 'George', '#116 France', '#116 France', 'M', 25, 434524);
insert into customer VALUES(1002, ' Becker', '#114 New York', ', #114 New York', 'M', 45,
431525);
select * from Customer;

5 CODE :

Alter table Customer


add constraint Custid_prim PRIMARY KEY(Customerid);

6 CODE:

insert into customer VALUES(1002, 'John', ' #114 Chicago', ' #114 Chicago', 'M', 45, 439525);
7.CODE:

Alter table Customer

drop primary key;

insert into customer VALUES(1002, ' Becker', '#114 New York', ' #114 New York', 'M', 45,
431525);

insert into customer VALUES(1003, 'Nanapatekar', '#114 INDIA', ' #114 INDIA', 'M', 45,
431525);

SELECT * FROM CUSTOMER;

8.CODE:

Alter table Customer

add constraint Custid_prim PRIMARY KEY(Customerid);

-- primary key shouldn’t contain duplicate values but here in the table we have duplicate
values for customerid
9.CODE:

(as primary key not created in the above cannot be altered and the given values are more
than the columns of the table as phoneno is the last one but here we have one more
additional value)

Alter Customer table, drop constraint Custid_Prim;

insert into customer VALUES(1002, ' Becker', '#114 New York', ' #114 New York', 'M', 45,
431525, 15000.50);

insert into customer VALUES(1003, 'Nanapatekar', '#114 INDIA', ' #114 INDIA', 'M', 45,
431525, 20000.50);

10.CODE:

truncate table customer;


11.CODE:

ALTER TABLE CUSTOMER

add e_mail varchar2(50);

SELECT * FROM CUSTOMER;

12.CODE:

ALTER TABLE CUSTOMER

drop column e_mail ;

SELECT * FROM CUSTOMER;


13.CODE:
ALTER TABLE CUSTOMER
ADD EmailId varchar2(50);
SELECT * FROM CUSTOMER;

You might also like