![]() We are creating this unique constraint after defining a column data type. Finally, we are using the above command to see the constraints used for the Orders table: d+ Orders. In the above example, we have created a unique constraint on the cust_id column. After that, we will execute the below syntax to list all constraints (Primary key, check, unique) of the particular table. Unique constraint creates after defining the data type of the column.ĬREATE TABLE dis_uni (cust_ID INT, product_name VARCHAR (100) NOT NULL, product_price varchar (10) NOT NULL, product_discount NUMERIC, UNIQUE (CUST_ID)) By default, it will create a Btree index on the emp_id column. In the above example, we are creating a unique constraint on the emp_id column after defining a unique constraint, the index will automatically create on the emp_id column. Unique constraint creates at the time of defining the data type of the column.ĬREATE TABLE Emp_UNI (emp_id INT UNIQUE, emp_name character(10) NOT NULL, emp_address character(20) NOT NULL, emp_phone character(14), emp_salary INT NOT NULL, date_of_joining date NOT NULL)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |