0% found this document useful (0 votes)
54 views2 pages

Oracle DDL

Uploaded by

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

Oracle DDL

Uploaded by

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

--alter table customer add firstnmae varch2(100);

add new column in the table customer: firstname, lastname, age


alter table customer add firstname varchar2(100);
alter table customer add lastname varchar2(100);
alter table customer add age number(3);
run and goto the table refresh

since that the customername has a composite entity


already. we need to delete the said customername

alter table customer drop column customer_name;


run and goto the table refresh

--change the column name of customer firstname to FN


alter table customer rename column firstname to FN;
run and goto the table refresh

--set the default price of standrd price from null to 0


alter table product modify standardprice default 0;
run and goto the table refresh

--change the datatype of the FN to varchar2(300)


alter table customer modify FN varchar2(300);
run and goto the table refresh

--delete the column age in customer


alter table customer drop column age;
run and goto the table refresh

--create a new table and add the primary key constraint


--after creating the table
create table sample1(pid number(11,0));
run and goto the table on the left side and refresh

alter table sample1 add constraint sample1+pk primary key (pid);


run and goto the sample table

--set the table sutomer to read only


alter table customer read only
alter table customer modify FN varchar2(1000);
run and goto the table refresh

--set the customer table back to read write


alter table customer read write;
run and goto the table refresh

--change the name of the table sample1 to NewSample


rename sample1 to NewSample;
run and goto the table refresh

--delete the table NewSample (it will go the recycle bin)


drop table NewSample;
run (table is in the recyclebin and it can be restored)
--retrieve the NewSample table back to the table objects using the flashback
select original_name, operation, droptime from recyclebin;
flashback table newsample to before drop;
run

--permanent delete the NewSample table


drop table newspace purge;
run (no table in the recyclebin) cannot be restored

--add a table comment on the customer table


comment on table customer is 'this is customer table';
run (go to the table and click the details)

--add a column comment of the customer_id attribute of the customer table


comment on column customer.customer_id is 'this is customer id';

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