Vidyalelo
MySQL · Q898

MySQL

Programming · MySQL · question 898

Q898

What is the meaning of "REFERENCES" in table definition?

A.
Primary key
B.
NULL
C.
Foreign Key
D.
A "foreign Key" belong to this particular table
Answer

Answer: Option D

Solution

Answer: Option D
Solution:
In a table definition, the word "REFERENCES" is used to establish a connection between two tables.

Think of it like a "link" between two tables.

Here's a breakdown:

* "REFERENCES" indicates that a column in the current table is linked to a column in another table. This linked column is called a "Foreign Key".
* "Foreign Key": This key acts like a "reference" pointing to a corresponding value in the primary key of another table.
* "Primary Key": The primary key is a unique identifier for each row in a table.

Example:

Let's say we have two tables:
* "Customers" (with columns like customer_id, name, address)
* "Orders" (with columns like order_id, customer_id, order_date)

In the "Orders" table, the "customer_id" column would use "REFERENCES Customers(customer_id)". This means:
* Each "customer_id" in "Orders" must match a valid "customer_id" in the "Customers" table.
* The "Orders" table is "referencing" the "Customers" table using the "customer_id".

Therefore, the correct answer is Option C: Foreign Key.