Sobes.tech
Junior — Middle

Kas saaksid anda näite piirangust, mis on kehtestatud andmebaasile või süsteemile?

sobes.tech AI

Vastus AI-lt

Constraints in a database or system are used to ensure data integrity and proper functioning of the application. An example of a constraint in a database can be:

  • Uniqueness (UNIQUE) — ensures that values in a column or set of columns do not repeat.
  • Primary key (PRIMARY KEY) — uniquely identifies each record in the table.
  • Foreign key (FOREIGN KEY) — ensures referential integrity between tables.
  • NOT NULL — prohibits storing null values in a column.

For example, in a users table, a uniqueness constraint can be imposed on the email field to prevent registration of multiple accounts with the same address.