Asked in
Industrial Engineering
Business and Industry
Project Management
C Sharp

What is a constraint?

Answer

User Avatar
Wiki User
July 03, 2011 11:24PM

Constraint, in Project Management terms, means a factor that affects when an activity can be scheduled.

------------------------------------------------------------------------------------------

It can be some kind of a limitation or restriction.

webmaster at service.ztronics.com

------------------------------------------------------------------------------------------

Since this question has been categorised in Database Design, I will assume you mean what is a a constraint within a database...

You can have primary key, foreign key, alternate key and domain (aka check) constraints.

Domain contraints apply to a single field in a single row - e.g. whether or not nulls are allowed, or an enumerated list of allowed values.

Primary keys and alternate keys ensure that a for the column(s) in the key each row in the table has a unique value (or set of values if the key is composite).

Foreign keys ensure that if one table references another, that the reference exists in the parent table. This is normally linked to the primary key

e.g. this example (Oracle syntax) demonstrates these

create table employee (

employee_id number not null,

first_name varchar2(100) not null,

middle_names varchar2(100) null,

last_name varchar2(100) not null,

sex char(1),

ni_number varchar2(10) not null,

CONSTRAINT pk_employee PRIMARY KEY (employee_id),

CONSTRAINT ak_national_insurance UNIQUE (ni_number),

CONSTRAINT cc_sex CHECK sex in ('M', 'F')

);

create table emp_salary_hist (

employee_id number not nul,l

pay_review date not null,

pay_grade number not null,

salary number not null,

CONSTRAINT pk_emp_sal_hist PRIMARY KEY (employee_id, pay_review),

CONSTRAINT fk_employee FOREIGN KEY (employee_id) REFERENCES employee(employee_id)

);