unique-key Questions

9

Solved

I want to add complex unique key to existing table. Key contains from 4 fields (user_id, game_id, date, time). But table have non unique rows. I understand that I can remove all duplicate dates and...
Lydell asked 6/3, 2013 at 18:36

35

Solved

I am trying to migrate a users table in Laravel. When I run my migration I get this error: [Illuminate\Database\QueryException] SQLSTATE[42000]: Syntax error or access violation: 1071 Specified...
Leaden asked 21/5, 2014 at 14:35

9

When should I use KEY, PRIMARY KEY, UNIQUE KEY and INDEX?
Caldarium asked 2/10, 2010 at 8:5

4

I want to retrieve the unique ID of a machine. Like others I also did a lot of research, and found none of the process of Unique ID generation works perfectly. For Motherboard Serial Number (ID):...
Groundspeed asked 26/8, 2010 at 10:4

12

Solved

I'm using Entity Framework 5.0 Code First; public class Entity { [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public string EntityId { get; set;} public int FirstColumn { get; se...

8

Solved

I need to remove a unique key from my mysql table. How can remove that using mysql query. I tried this but it is not working alter table tbl_quiz_attempt_master drop unique key; Please help me ...
Shemeka asked 7/2, 2012 at 6:56

3

Solved

i want to make a table in MySQL server with mediumtext column as UNIQUE KEY CREATE TABLE `parts` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` mediumtext NOT NULL, `display_status` int(11) NOT...
Oak asked 25/12, 2012 at 19:20

7

Solved

One of my tables have a unique key and when I try to insert a duplicate record it throws an exception as expected. But I need to distinguish unique key exceptions from others, so that I can customi...
Allochthonous asked 20/7, 2015 at 11:50

3

I know what a superkey means in SQL but I have the following questions: Does an empty SQL table always have a superkey? Does every SQL table always have a superkey?
Holston asked 3/9, 2017 at 15:20

5

What is the PC unique ID? How could we get the PC unqiue ID? Is it about Hard disk or motherboard? I'd like to store PC ID in my window program. Please share me.
Participial asked 26/9, 2011 at 3:18

2

Solved

I have a table with 4 columns: ID, type, owner, description. ID is AUTO_INCREMENT PRIMARY KEY and now I want to: ALTER IGNORE TABLE `my_table` ADD UNIQUE (`type`, `owner`); Of course I have few...
Beastings asked 28/3, 2011 at 8:41

4

Solved

Could someone clarify what is the purpose of having unique index without unique constraint (Oracle)? For example, create table test22(id int, id1 int, tmp varchar(20)); create unique index idx_te...
Sportsman asked 22/9, 2011 at 21:37

3

Solved

If I define a column as a primary key in MySQL, is it also unique key by default or do I need to also define it as unique key (in case I want it to be unique)? I saw this question What is the diffe...
Daryl asked 18/6, 2015 at 9:43

5

Solved

I'm trying to create a relation where any of four different parts may be included, but any collection of the same parts should be handled as unique. Example: An assignment must have an assigned co...
Biel asked 9/1, 2009 at 21:26

3

Solved

I have a table with a unique key for two columns: CREATE TABLE `xpo`.`user_permanent_gift` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT , `fb_user_id` INT UNSIGNED NOT NULL , `gift_id` INT UNSIGNED...
Burchette asked 4/1, 2011 at 17:13

15

Solved

I'm using a MySQL database. In which situations should I create a unique key or a primary key?
Rew asked 5/3, 2012 at 11:39

2

I'm having problems with MySQL composed unique key. It consists of URL, integer value and date field. But when I try to insert row, I get an exception: Caused by: com.mysql.jdbc.exceptions.jdbc4...
Solitta asked 19/2, 2012 at 11:48

6

Solved

I've got an error on MySQL while trying to add a UNIQUE KEY. Here's what I'm trying to do. I've got a column called 'unique_id' which is VARCHAR(100). There are no indexes defined on the table. I'm...
Dudeen asked 24/7, 2013 at 0:35

2

Solved

I have an email field that's optional. The regex works fine accepting the empty string (^$) but now the issue is that the empty string is considered a unique entry. It will only allow one user to r...
Valenza asked 3/3, 2018 at 17:36

2

Solved

I know that i can make two columns unique keys, but that's not exactly what i want. I want that for example if col1='1', col2='2' then there can't be another row with col1='1', col2='2', but...
Arezzini asked 22/12, 2017 at 13:48

11

Solved

I tried to find it out in google but not satisfactory answer is given out there. Can anybody explain the solid difference. actually if Primary key is used to select data uniquely then what is the...
Bolanger asked 4/6, 2010 at 10:52

9

Solved

I'm trying to write a method that will return a Hibernate object based on a unique but non-primary key. If the entity already exists in the database I want to return it, but if it doesn't I want to...
Soddy asked 16/2, 2011 at 22:16

3

What are the differences between Unique Key, Primary Key and Foreign Key with respect to concept of SQL? How they are different from each other?
Verdieverdigris asked 25/4, 2015 at 9:27

3

Solved

I am new to SQL Server and while learning about clustered index, I got confused! Is unique key clustered or a non-clustered index? Unique key holds only unique values in the column including null,...
Viscid asked 4/9, 2016 at 15:29

3

Solved

I am using angularjs for my page. I want to filter the values from the JSON object, So that no redundancy exists. But I didn't find any way to get the unique values from angular ng-repeat. Is there...
Loaiasis asked 11/9, 2013 at 17:29

© 2022 - 2024 — McMap. All rights reserved.