473,546 Members | 2,239 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Foreign key refer to unique constraint????

foreign key also refer to unique constraint.
(GREAT...)

1.then table that containt unique constraint act as master table?????
2.IS unique constraint will replace with primary key??
3.Is unique constraint gives all fuctionality as primary key constraint???

thanks
kuljeet pal singh
Jul 19 '05 #1
3 11186
> foreign key also refer to unique constraint.
(GREAT...)

1.then table that containt unique constraint act as master table?????
Yes.
2.IS unique constraint will replace with primary key??
3.Is unique constraint gives all fuctionality as primary key constraint???


The only diference between PK and UK (besides built-in indexes) is
that UK can contain NULLs, whereas PK cannot. A given table could
contain many rows with a NULL in the UK column (this is, the
'uniqueness' affects only NOT NULL columns).

Regards.

Carlos.
Jul 19 '05 #2
> foreign key also refer to unique constraint.
(GREAT...)

1.then table that containt unique constraint act as master table?????
Yes.
2.IS unique constraint will replace with primary key??
3.Is unique constraint gives all fuctionality as primary key constraint???


The only diference between PK and UK (besides built-in indexes) is
that UK can contain NULLs, whereas PK cannot. A given table could
contain many rows with a NULL in the UK column (this is, the
'uniqueness' affects only NOT NULL columns).

Regards.

Carlos.
Jul 19 '05 #3
ku***********@h otmail.com (KULJEET) wrote in message news:<fe******* *************** ****@posting.go ogle.com>...
foreign key also refer to unique constraint.
(GREAT...)

1.then table that containt unique constraint act as master table?????
2.IS unique constraint will replace with primary key??
3.Is unique constraint gives all fuctionality as primary key constraint???

thanks
kuljeet pal singh


Yes, a FK can refer to a UK or a PK. This is desirable as some table
will have both a PK and UK on them and it may be necessary to validate
against both.

If this bothers you
What is the difference between a unique index and a unique constraint?
http://www.jlcomp.demon.co.uk/faq/uk_idx_con.html

HTH -- Mark D Powell --
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
6369
by: Luc Martineau | last post by:
Hello When we create a table, what is the difference between the REFERENCE constraint on column and the FOREIGN KEY constraint on table ? I guess that the FOREIGN KEY constraint assures us that the referenced column is a PRIMARY KEY in an another table. You can reference any colums with the REFERENCE constraint on column. Am I right?
10
42384
by: Bodza Bodza | last post by:
I'm having an argument with an incumbent self-taught programmer that it is OK to use null foreign keys in database design. My take is the whole point of a foreign key is that it's not supposed to be optional, it's very definition is it's a necessary link to the parent table and part of the definition. If it's optional it shouldn't be part...
31
3336
by: Robert Brown | last post by:
Let's say I have a type hierarchy: (just an example) the general entity customer: CREATE TABLE customer(customer_id int, customer_name varchar(250), customer_type int) three specific customer subtypes: 1 - business, 2 - home, 3 - university
4
3159
by: teddysnips | last post by:
This is a rather abstract question about data design, but I ask it here because a) the database is SQL Server, and b) you're such a learned bunch! Let's assume the classic relation of Customers and Orders, where an Order may reference a single Customer. If I was designing such a relation from scratch, I would create the Customer table with...
0
1418
by: Scott Ribe | last post by:
I've got a problem which I think may be a bug in Postgres, but I wonder if I'm missing something. Two tables, A & B have foreign key relations to each other. A 3rd table C, inherits from A. A stored procedure updates a row in C, adds a row each in B & C. I get an integrity violation. All the foreign keys are deferrable, and the stored...
1
3767
by: ken_knee | last post by:
I have a PARENT/CHILD I'm attempting to attach another CHILD to. When I try to add a FOREIGN KEY to the 3rd table referring to CHILD1 (AGTERNS), I get error SQL0573N A column list specified in the references clause of constraint "RCAGTRNZ" does not identify a unique constraint of the parent table "VCSTSTNT.AGTERNS". Since CHILD1 has...
5
2484
by: Bob Stearns | last post by:
For good and sufficient reasons I wish to insure that a primary key of table 1 is not a primary key of table 2. The following does not work: ALTER TABLE IS3.AUCTION_SUPER_CATEGORIES ADD CONSTRAINT code_not_fk check(code not in (select code from IS3.AUCTION_CATEGORIES where auction_id=auction_id)) Is there any way other than a trigger...
3
174
by: KULJEET | last post by:
foreign key also refer to unique constraint. (GREAT...) 1.then table that containt unique constraint act as master table????? 2.IS unique constraint will replace with primary key?? 3.Is unique constraint gives all fuctionality as primary key constraint??? thanks kuljeet pal singh
0
3011
by: Frank Swarbrick | last post by:
So we're trying to decide if it's better to use IDENTITY columns or sequences to create a surrogate key as the primary key for our tables. I kind of like the identity column, because it's more 'tightly integrated' in to the table. With a sequence you have to make sure that each application that inserts records uses the same sequence. ...
0
7504
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7947
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7461
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6026
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3491
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1921
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.