Custom Search
www.rocket99.com : Technical Guides Sybase Oracle UNIX Javascript


Technical Guides
Sybase
Oracle
UNIX
Javascript




Of Interest

Business Intelligence and Analytics



Oracle Training





Sybase » DDL » Design »

Creating a constraint

     




Contraints are used to define primary keys, enforce uniqueness, and to describe
foreign key relationships. Note that unique or primary key constraints
create indexes upon creation.


/* primary key for the employee table */
alter table employee add constraint
emp_constr primary key(emp_id)
go
/* add unique requirement for invoice table */
alter table invoice add constraint
inv_constr unique nonclustered(cust_id,inv_date)
go
/* add foreign key for relationship between invoice and employee */
alter table invoice add constraint inv_fk_emp
foreign key (sales_rep_id)
references employee(emp_id)
go









Sybase : Related Topics

Sybase : DDL : Sybase data types
Sybase : DDL : Creating a table
Sybase : DDL : Altering a table
Sybase : DDL : Creating an index
Sybase : DDL : Clustered vs non-clustered indexes
Sybase : DDL : Table Partitioning
Sybase : DDL : Modifying a Colunm
Sybase : DDL : Alter a column

Sybase Web Site
Sybase iAnywhere Mobile Web Site
Oracle Enterprise Web Site



Get the latest Rocket99 news and tech tips via






Site Index About this Guide to Sybase, Oracle, and UNIX Contact Us Advertise on this site




Copyright © 2016 Stoltenbar Inc All Rights Reserved.