About 491,000 results
Open links in new tab
  1. MySQL UNIQUE Constraint - W3Schools

    To create a UNIQUE constraint on the "ID" column when the table is already created, use the following SQL: To name a UNIQUE constraint, and to define a UNIQUE constraint on multiple …

  2. MySQL Create Table with Unique Constraints - Stack Overflow

    Jul 19, 2014 · CREATE TABLE `people` ( `_id` INT NOT NULL AUTO_INCREMENT, `lastName` varchar(255) NOT NULL, `firstName` varchar(255) NOT NULL, `JSON` TEXT NOT NULL, …

  3. How do I specify unique constraint for multiple columns in MySQL?

    To add a unique constraint, you need to use two components: ALTER TABLE - to change the table schema and, ADD UNIQUE - to add the unique constraint. You then can define your new …

  4. MySQL UNIQUE Constraint - MySQL Tutorial

    A UNIQUE constraint can be either a column constraint or a table constraint. To define a UNIQUE constraint for a column when creating a table, you use the following syntax: CREATE TABLE …

  5. MySQL UNIQUE Constraint - GeeksforGeeks

    Jul 10, 2024 · In this article, we have covered how to use UNIQUE constraint with CREATE TABLE and ALTER TABLE statements. We also checked how to remove unique constraint …

  6. MySQL: Unique Constraints - TechOnTheNet

    The syntax for creating a unique constraint using a CREATE TABLE statement in MySQL is: CREATE TABLE table_name ( column1 datatype [ NULL | NOT NULL ], column2 datatype [ …

  7. How to Create a UNIQUE Constraint in MySQL - Database.Guide

    Oct 18, 2024 · We can add UNIQUE constraints to an existing table using ALTER TABLE. We can apply UNIQUE constraints across multiple columns to enforce uniqueness on …

  8. MySQL Constraint - w3resource

    Apr 19, 2024 · MySQL CONSTRAINT is declared at the time of creating a table. MySQL CONSTRAINTs are: In MySQL NOT NULL constraint allows to specify that a column can not …

  9. Create Unique Constraint with NULL Columns in MySQL

    Sep 18, 2024 · The syntax for creating a unique constraint with NULL columns in MySQL involves specifying the UNIQUE keyword during table creation or altering an existing table: CREATE …

  10. Understanding UNIQUE constraint in MySQL 8: A Developer’s …

    Jan 26, 2024 · Creating a Table with a UNIQUE Constraint CREATE TABLE users ( id INT AUTO_INCREMENT, email VARCHAR(255) NOT NULL, username VARCHAR(255) NOT …