SQL Server: Unique Constraint

Level : Beginner
Mentor: Shailendra Chauhan
Type : GuidedLab
Points : 10
Duration : 00:15:00

Lab Details

Description

A UNIQUE constraint specifies that the values in a column must be unique. This constraint ensures that invalid data does enter the column. A UNIQUE constraint can be applied to multiple columns.

In this lab, you will learn how to add a UNIQUE Constraint to a table in SQL Server.


Based on this Customer and Supplier Schema, generate the solutions to the respective queries listed below:

  1. Create a customer table and the ‘Email’ value must be unique.
  2. Add a UNIQUE Constraint to the ‘Phone’ Column in an existing Customer table.
  3. In the Customer Table, a combination of two columns (LastName, Phone) must be unique.

Lab Objective

Upon completion of this lab, you will be able to:

  • Gain Hands-On Experience on SQL Server UNIQUE Constraint.

Prerequisites

  • You should have a conceptual understanding of Constraints.
  • You must have SQL Server Installed on your systems.


Self-paced Membership
  • 22+ Video Courses
  • 800+ Hands-On Labs
  • 400+ Quick Notes
  • 55+ Skill Tests
  • 45+ Interview Q&A Courses
  • 10+ Real-world Projects
  • Career Coaching Sessions
  • Email Support
Upto 60% OFF
Know More
Still have some questions? Let's discuss.
CONTACT US
Accept cookies & close this