Examveda

What is the role of "CONSTRAINS" in defining a table in Mysql?

A. Declaring primary key

B. Declaring Foreign Key

C. Restrictions on columns

D. All of the mentioned

Answer: Option D

Solution (By Examveda Team)

strong>Constraints are like rules that we set for the data in our table. They make sure our data is accurate and consistent.
Let's look at the options:
Option A: Declaring primary key
A primary key is a special column that uniquely identifies each row in a table. This is a type of constraint.
Option B: Declaring Foreign Key
A foreign key connects tables by linking a column in one table to the primary key of another table. This is also a constraint.
Option C: Restrictions on columns
Constraints can also put restrictions on individual columns. For example, we can make sure a column only accepts numbers or that it doesn't allow empty values.
Option D: All of the mentioned
Since all the options are types of constraints, the correct answer is Option D: All of the mentioned.

This Question Belongs to MySQL >> MySQL Miscellaneous

Join The Discussion

Related Questions on MySQL Miscellaneous