ComputerHowToGuy.com

How to create an index in Oracle

CREATE INDEX my_table_my_column_idx on my_table(my_column);


How to modify the default value for a column in Oracle

ALTER TABLE my_table MODIFY my_column DEFAULT 1;


How to drop a constraint in Oracle

ALTER TABLE my_table DROP CONSTRAINT my_table_uk1;

How to add a foreign key constraint in Oracle

ALTER TABLE "MYTABLE" ADD CONSTRAINT "MYTABLEFK1" FOREIGN KEY ("MYCOLUMN")
REFERENCES "OTHERTABLE" ("OTHERCOLUMN") ENABLE;

How to add a column to a table in Oracle

ALTER TABLE my_table ADD new_column NUMBER;


How to drop a column in Oracle

ALTER TABLE my_table DROP COLUMN my_column;


Oracle – Add Comment To Table

Question:

How do I add a comment to a table in Oracle database?

Answer:

If your table is named my_oracle_table, you would execute the following command.

COMMENT ON TABLE my_oracle_table IS 'This is a special table.';

Oracle – Add Comment To Column

Question:

How do I add a comment to a column in Oracle database?

Answer:

If your table is named my_oracle_table and your column is named my_oracle_column, you would execute the following command.

COMMENT ON COLUMN my_oracle_table.my_oracle_column IS 'This is a special column.';

Adding a comment on a column, or any other database schema object, can help you maintain your system. It allows you to give verbose descriptions for objects where the object name itself is not enough. For example, if you had a column called RoleType it would be nice to know which values are acceptable for that column. So your description could say “RoleType accepts the following user role strings: SysAdmin, Admin, User”.


Get Oracle Version

Question:

How do I know which version of Oracle I’m running?

Answer:

Execute the following command.

COL PRODUCT FORMAT A35
COL VERSION FORMAT A15
COL STATUS FORMAT A15 
SELECT * FROM PRODUCT_COMPONENT_VERSION;

FTP upload with PHP

In this tutorial I will demonstrate how to perform FTP uploads using PHP. Read more…


Next Page »