Example: Enable/disable primary key StudentsPrimaryKey on students table.
ALTER TABLE students ENABLE CONSTRAINT StudentsPrimaryKey
ALTER TABLE students DISABLE CONSTRAINT StudentsPrimaryKey
Showing posts with label Oracle Constraints. Show all posts
Showing posts with label Oracle Constraints. Show all posts
How to add primary key to a table?
Example: Add primary key to students table on ID column.
ALTER TABLE students ADD CONSTRAINT "StudentsPrimaryKe" PRIMARY KEY (ID)
ALTER TABLE students ADD CONSTRAINT "StudentsPrimaryKe" PRIMARY KEY (ID)
Oracle tips?
- When you successfully exit SQL*Plus, execute one of DDL, DCL statements (even if they fail) or use ROLLBACK TO SAVEPOINT X there will occure implicit COMMIT for the open transaction.
- When there is system crash there will occur automatic commit.
- Subqueries are processed from most inner one to the most outer one.
- If we create a synonym for an object in a schema, any user granted on this object can also access this object by using synonym for that object.
- If we modify default value of an existing column on a table, default value will be used for inserts after that point, rows those have been added before with NULL value on the column will not be change.
- Constraints can be added at creation time of tables and also after creation.
Subscribe to:
Comments (Atom)