Adding table constraints, PL-SQL Programming

Adding Table Constraints




PRIMARY KEY (StudentId, CourseId) ;

  1. ALTER TABLE ENROLMENT specifies that the definition of base table ENROLMENT is to be modified in some way, such as adding or dropping a column, adding or dropping a constraint (among other things).
  2. ADD CONSTRAINT NameNotNull specifies that in fact a constraint is being added to the definition of ENROLMENT, and the name by which that constraint can subsequently be referred to is NameNotNull. For example, the name would be needed if the constraint were later to be dropped, or perhaps it could appear in an error message when an attempted update is rejected for violating that constraint. Similar comments apply to ADD CONSTRAINT PK_StudentId_CourseId.
  3. CHECK (Name IS NOT NULL) specifies a truth-valued expression, Name IS NOT NULL, that must be satisfied by each row of every table that is assigned to ENROLMENT. If the current value of ENROLMENT fails to satisfy this constraint, then the ALTER TABLE statement fails.
  4. PRIMARY KEY ( StudentId, CourseId ) used for constraint. Again, the ALTER TABLE statement fails if the constraint is not satisfied by the current value of ENROLMENT.
Posted Date: 1/18/2013 2:57:17 AM | Location : United States

Related Discussions:- Adding table constraints, Assignment Help, Ask Question on Adding table constraints, Get Answer, Expert's Help, Adding table constraints Discussions

Write discussion on Adding table constraints
Your posts are moderated
Related Questions
Managing Cursors The PL/SQL uses 2 types of cursors: implicit and explicit. The PL/SQL declares a cursor implicitly for all the SQL data manipulation statements, including th

Table Literals - SQL One might expect SQL to support table literals in the manner illustrated in Example 2.2, but in fact that is not a legal SQL expression. Example: Not a

Fetching Across Commits The FOR UPDATE clauses acquire exclusive all row locks. All rows are locked when you open the cursor, and when you commit your transaction they are unl

BIOCHE M ICA L ORIGIN OF LIFE - It is generally agreed by astronomers, geologists and biologists that the earth is approximately 4500-5000 million years old. It is an

Keyword &Parameter Description: index_name: This is an undeclared identifier which can be referenced only within the FORALL statement and only as the collection subscript

ALTER TABLE bb_basketitem ADD CONSTRAINT bitems_qty_ck CHECK (quantity BEGIN INSERT INTO bb_basketitem VALUES (88,8,10.8,21,16,2,3); END; Brewbean’s wants to add a check

Example of GROUPBY Operator Example: How many students sat each exam, using GROUP BY, NATURAL LEFT JOIN, and COALESCE SELECT CourseId, COALESCE (n, 0) AS n FROM COURS

Processing Transactions This part describes how to do the transaction processing. You learn the fundamental techniques that safeguard the consistency of your database, involvin

Bitmap Join Indexes - This feature will increase the performance and detains the size and format of your databases in data Character Semantics and Globalization -This featur

Example of Foreign Key Constraint Example: Alternative formulation for 6.3 as a foreign key constraint ALTER TABLE EXAM_MARK ADD CONSTRAINT Must_be_enrolled_to_take_exam