Questions tagged [unique-key]

A key is a set of attributes that is irreducibly unique and non-nullable within a table.

A key is a set of attributes that is irreducibly unique and non-nullable within a table. Irreducible means that all the attributes of the key are necessary to guarantee uniqueness - remove any one attribute and the uniqueness property would be lost. A key may consist of zero, one or more attributes and a relational table (relation variable) must have at least one key and may have more than one.

Keys are unique by definition so the commonly used term "unique key" is actually a tautology.

515 questions
-1
votes
4 answers

Unique serial number using php/javascript

Is there a way to get a unique serial number for machines such as Mac,Windows and devices such as iPhone,Blackberry using php/javascript?
user475685
  • 8,041
  • 7
  • 26
  • 24
-1
votes
2 answers

MYSQL, Error 1062

I am having an issue inserting values into a table. I am receiving the Error Code: 1062 error message. Using SHOW CREATE TABLE roof_panel_width; the CREATE code for the table in question was returned. CREATE TABLE `roof_panel_width` ( `rpw_id`…
Brook Julias
  • 2,085
  • 9
  • 29
  • 44
-1
votes
1 answer

I want to implement something that doesn't allow the user to rate more than once

I have used someone else's code that uses the ipaddress way. However, I would like to use a code that checks for the current userid and the id number. $ipaddress = md5($_SERVER['REMOTE_ADDR']); // here I am taking IP as UniqueID but you can have…
Amir HD
  • 21
  • 2
-1
votes
2 answers

How to add extra constraint to table?

This my table: customer_id user_id password email first_name last_name My primary key is customer_id which is generated by the system. How can I prevent a user form creating multiple accounts? Should I put a constrain on another column?
J Sam
  • 13
  • 1
-1
votes
1 answer

SQL. Unique and Primary Key

My requirement is having a table of products which cannot have similar vendor, product and version at the same time. But, I also want this table to be referenced on another table by its primary key, as for the distinct vendor, product version I use…
aDoN
  • 1,877
  • 4
  • 39
  • 55
-1
votes
2 answers

Add two indexes to the same field in MySql

I have a table like this: something a [INT] b [INT] c [INT] ...where a, b and c are separate Foreign Keys pointing to three different table.id. Since I want to make all regs be unique, and after having read this great answer, I think I should create…
Mark Tower
  • 559
  • 1
  • 5
  • 15
-1
votes
1 answer

How to generate a 64 bit key in php

I have been trying up with random number generators in php to generate keys for photos structure on the website I am building. I recently came to know that Facebook as well as Instagram fit there photo ids in 64 bit. Facebook Engineering Note -:…
Andrew Eisenberg
  • 117
  • 1
  • 1
  • 7
-1
votes
3 answers

Map unique number to a unique string of 6 characters

I have a database table where every row has its unique ID (RowID). Is there a good way to convert this RowID to a unique key that is always 6 characters in length. Unique key characters can be {A-Za-z0-9}. One example of unique key would be:…
Jón Trausti Arason
  • 4,548
  • 1
  • 39
  • 46
-1
votes
3 answers

How to give a unique number to add new product on website

I am creating a ecommerce website, there i want to give a unique number to the product while adding. I want to do it in a way that it will automatically takes the number for this right now i m using time() function. with this a product get the time…
Harish Kumar
  • 927
  • 3
  • 20
  • 46
-2
votes
0 answers

Need to Join 3 Tables Based on Multiple Identical Values

I have 3 medical provider tables that need to be joined. They are Medical Providers Table NPI Full_Name Address City State Zip 111333 John Doe Office 1 Dallas TX 77456 111333 John Doe …
J.R.
  • 59
  • 1
  • 9
-2
votes
1 answer

How can I resolve this warning ? "Encountered Two Children with the same key, `.$1/.$2`"

I am making a select input in my react native App using import "react-native-form-select-picker", And the code is working fine still it is giving me a warning as "Encountered Two Children with the same key, `.$1/.$2". So how can I fix this Issue…
MOHAMMAD SIDDIQUE
  • 223
  • 2
  • 5
  • 17
-2
votes
2 answers

Composite primary key? Or an auto increment primary key with unique composite index?

I have two tables named Student and Course and a join table named StudentCourse. Both Student and Course have an auto increment integer Id. StudentCourse table will have at most 10,000 records (not more!) and I will use this table for select some…
-2
votes
1 answer

How to create a unique index on three variables in Java?

I have searched for how to create a unique index, but I haven't seen any guides doing it. I want to put a unique key on three variables in my document. x, y, and z. I'm storing coordinates, and need to make sure I can't have duplicate x, y, and z…
Jeff smith
  • 147
  • 7
-2
votes
2 answers

Alter a table add unique key in my SQL Server database?

I wrote code like ALTER TABLE [dbo].[Questions] ADD UNIQUE (Question); But it shows error like Column 'Question' in table 'Questions' is of a type that is invalid for use as a key column in an index. Please help me..
SURESH MOGUDALA
  • 35
  • 1
  • 12
-2
votes
3 answers

How to Generate random numbers without the same number

Can you please give me the answer how can i generate numbers without the same numbers ? Because i am creating a lottery program, and i want my program having no same numbers because the lottery is not having an output that has the same numbers.
1 2 3
34
35