answersLogoWhite

0


Best Answer

A foreign key is determined by the underlying database model. Usually, a foreign key points to the "primary key" of the table that it references. In Access, for example, a lookup field holds the ID of the record you are referencing, while displaying whichever field you specify from the referenced table. In MySQL and most other RDBM systems, you can query the data using a LEFT JOIN or RIGHT JOIN based using the form "a.relatedid = b.id", where "a" is an alias to the child record (the one with the lookup field), and "b" is the primary key on the parent record.
A query on a foreign key might look like this: "select * from `orders` a left join `customers` b on a.`customerid` = b.`id`". In this query, you would see the order plus the customer that placed the order, each order on it's own line. Customers may be duplicated, since they might have multiple orders in the database. Of course, this assumes that "customerid" is the field on the "orders" table that contains the foreign key relationship, and "id" is a primary key on the "customers" table.
The primary key must be unique to be useful. This is usually defined as an AUTO_INCREMENT field, but it may also be some other value guaranteed to be unique, such as a randomly assigned UUID or customer number.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: If a table has foreign keys which normal form is it in?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How many foreign keys can you have in one table?

one


Can a primary key be a foreign key?

Yes, a primary key can also be a foreign key. This is known as a composite key, where one or more columns in a table are both primary keys for that table and also act as foreign keys linking to another table.


How functional dependency is related to database table design?

The functional dependency is related to the database table design through the foreign and primary keys. The foreign and primary keys are functionally dependent on each other.


What the differences between primary key and foreign key?

A primary key is a unique identifier for a record in a table and ensures each record is uniquely identified. A foreign key establishes a relationship between two tables by referencing the primary key in another table. It enforces referential integrity by ensuring that the values in the foreign key column correspond to values in the primary key column of another table.


What are characteristics of fact table?

Fact table contain at least one fact column or measurement column that represent sum or average. It contains primary keys of dimension tables as foreign keys.


Can primary keys be foreign keys in the same table?

Yes. This is referred to as a self reference or circular relationshiop with just one Table. One classic example is an Employee table and some employees are managers and hence have child Employees.


When was Foreign Keys created?

Foreign Keys was created in 1985.


What is an explanation of first normal form?

First Normal Form (1NF) is used to describe a database where all data is atomic and isomorphic. This means that each field has exactly one value (it is not a combination of values), and that does not depend on any other value in that row, and each row does not depend on any other row in the same table (although they may depend on other tables; that's the point of foreign keys). Source: Wikipedia


What is the relationship between tables in library management system?

In a library management system, tables represent different entities such as books, users, transactions, etc. The relationship between these tables is established through keys like primary keys and foreign keys. For example, the books table may have a primary key "book_id" which is referenced as a foreign key in the transactions table to link books with users.


What is the foreigh key in DBMS explainwith example?

In the context of relational databases, a foreign key is a referential constraint between two tables.[1] The foreign key identifies a column or a set of columns in one (referencing) table that refers to a column or set of columns in another (referenced) table. The columns in the referencing table must be the primary key or other candidate key in the referenced table. A table may have multiple foreign keys, and each foreign key can have a different referenced table. Each foreign key is enforced independently by the database system. Therefore, cascading relationships between tables can be established using foreign keys. Improper foreign key/primary key relationships or not enforcing those relationships are often the source of many database and data modeling problems.


What Foreign key?

In the context of relational databases, a foreign key is a referential constraint between two tables.[1] The foreign key identifies a column or a set of columns in one (referencing) table that refers to a column or set of columns in another (referenced) table. The columns in the referencing table must be the primary key or other candidate key in the referenced table. The values in one row of the referencing columns must occur in a single row in the referenced table. Thus, a row in the referencing table cannot contain values that don't exist in the referenced table (except potentially NULL). This way references can be made to link information together and it is an essential part of database normalization. Multiple rows in the referencing table may refer to the same row in the referenced table. Most of the time, it reflects the one (master table, or referenced table) to many (child table, or referencing table) relationship. The referencing and referenced table may be the same table, i.e. the foreign key refers back to the same table. Such a foreign key is known in SQL:2003 as self-referencing or recursive foreign key. A table may have multiple foreign keys, and each foreign key can have a different referenced table. Each foreign key is enforced independently by the database system. Therefore, cascading relationships between tables can be established using foreign keys. Improper foreign key/primary key relationships or not enforcing those relationships are often the source of many database and data modeling problems.


What is a foreign key?

In the context of relational databases, a foreign key is a referential constraint between two tables.[1] The foreign key identifies a column or a set of columns in one (referencing) table that refers to a column or set of columns in another (referenced) table. The columns in the referencing table must be the primary key or other candidate key in the referenced table. The values in one row of the referencing columns must occur in a single row in the referenced table. Thus, a row in the referencing table cannot contain values that don't exist in the referenced table (except potentially NULL). This way references can be made to link information together and it is an essential part of database normalization. Multiple rows in the referencing table may refer to the same row in the referenced table. Most of the time, it reflects the one (master table, or referenced table) to many (child table, or referencing table) relationship. The referencing and referenced table may be the same table, i.e. the foreign key refers back to the same table. Such a foreign key is known in SQL:2003 as self-referencing or recursive foreign key. A table may have multiple foreign keys, and each foreign key can have a different referenced table. Each foreign key is enforced independently by the database system. Therefore, cascading relationships between tables can be established using foreign keys. Improper foreign key/primary key relationships or not enforcing those relationships are often the source of many database and data modeling problems.