phpMyAdmin#1062-键'PRIMARY'的重复条目'' [英] phpMyAdmin #1062 - Duplicate entry '' for key 'PRIMARY'

查看:101
本文介绍了phpMyAdmin#1062-键'PRIMARY'的重复条目''的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在分配作业时遇到麻烦,有人可以帮我吗

i'm having a bit of trouble with an assignment, can anyone help me please

我需要做些什么来解决此问题,我会不断收到#1062错误消息

what do i need to do to fix this, i keep getting a #1062 error message

-- phpMyAdmin SQL Dump
-- version 4.2.9.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: March 04, 2015 at 15:00
-- Server version: 5.6.22-log
-- PHP Version: 5.5.15-pl0-gentoo

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `mydb1931`
--

-- --------------------------------------------------------

--
-- Table structure for table `Present Cast`
--

CREATE TABLE IF NOT EXISTS `Present Cast` (
  `Character` varchar(100),
  `Actor(s)` varchar(100),
  `Duration` varchar(100)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `Present Cast`
--

INSERT INTO `Present Cast` (`Character`, `Actor(s)`, `Duration`) VALUES
('Tony Hutchinson', 'Nick Pickard', '1995-'),
('Cindy Cunningham', 'Stephanie Waring', '1995-2001, 2002'),
(NULL, 'Laura Crossley', '2004, 2008-'),
('Jack Osborne', 'Jimmy McKenna', '1996-'),
('Darren Osborne', 'Ashley Taylor Dawson', '1996-97, 1999-2000'),
(NULL, 'Adam Booth', '2003-'),
('Holly Cunningham', 'Amanda Clapham', '1997-2001'),
(NULL, 'Wallis Day', '2002, 2004'),
(NULL, 'Lydia Waters', '2008-10'),
(NULL, 'Karis Sharkey', '2012-'),
('Tom Cunningham', 'Ellis Hollins', '1999-'),
('Frankie Osborne', 'Helena Pearson', '2002-'),
('Nancy Hayton', 'Jessica Fox', '2006-'),
('Ste Hay', 'Kieron Richardson', '2006-'),
('Mercedes McQueen', ' Jennifer Metcalfe', '2006-'),
('Myra McQueen', 'Nicole Barber-Lane', '2006-'),
('John Paul McQueen', 'James Sutton', '2006-08, 2012-'),
('Charlie Dean', 'Charlie Beham', '2006-'),
(NULL, 'Joshua McConville', NULL),
('Leah Barnes', 'Ela-May Dermican', Null),
(NULL, 'Jessica Croft-Lane', '2007-'),
(NULL, 'Magic Hurst', NULL),
('Nana McQueen', 'Diane Langton', '2007-09, 2012-'),
('Harry Thompson', 'Parry Glasspool', NULL),
(NULL, 'Harrison George Rhodes','2007-09, 2015-'),
(NULL, 'Daniel Seymour', NULL),
('Theresa McQueen', 'Jorgie Porter', '2008-'),
('Lucas Hay', 'William Hall', NULL),
(NULL, 'Reuben Thwaites', '2009-'),
(NULL, 'Jude Hawley', NULL),
('Sinead O Connor', 'Stephanie Davis', '2010-'),
('Diane O Connor', 'Alex Fletcher', '2010-'),
('Esther Bloom', 'Jazmine Franks', '2011-'),
('Dirk Savage', 'David Kennedy', '2011-'),
('Phoebe McQueen', 'Mandip Gill', '2012-'),
('Maxine Minniver', 'Nikki Sanderson', '2012-'),
('Sienna Blake', 'Anna Passey', '2012-'),
('Patrick Blake', 'Jeremy Sheffield', '2012-'),
('Robbie Roscoe', 'Charlie Wernham', '2013-'),
('Trevor Royle', 'Greg Wood', '2013-'),
('Freddie Roscoe', 'Charlie Clapham', '2013-'),
('Jason Roscoe', 'Alfi Browne-Sykes', '2013-'),
('Joe Roscoe', 'Ayden Callaghan', '2013-'),
('Ziggy Roscoe', 'Fabrizio Santino', '2013-'),
('Lindsey Butterfield', 'Sophie Austin', '2013-'),
('Peri Lomax', ' Ruby O Donnell', '2013-'),
('Tegan Lomax', 'Jessica Ellis', '2013-'),
('Leela Lomax', 'Kirsty-Leigh Port', '2013-'),
('Grace Black', 'Tamara Wall', '2013-'),
('Nico Blake', 'Persephone Swales-Dawson', '2014-'),
('Cameron Campbell', 'Cameron Moore', '2014-'),
('Kim Butterfield', 'Daisy Wood-Davis', '2014-'),
('Dr. Charles Savage', 'Andrew David Grennough', '2014-'),
('Lockie camobell', 'Nick Rhys', '2014-'),
('Porsche McQueen', 'Twinnie Lee Moore', '2014-'),
('Celine McQueen', 'Sarah George', '2014-'),
('Dylan Jenkins', 'James Fletcher', '2015-'),
('Cleo McQueen', 'Nadine Mulkerrin', '2015-');

-- --------------------------------------------------------
--
-- Indexes for table `Present Cast`
--
 ALTER TABLE `Present Cast`
 ADD PRIMARY KEY (`Character`);

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

我一直收到一条错误消息,内容为:

i keep receiving an error message that reads

#1062 - Duplicate entry '' for key 'PRIMARY'

感谢任何有帮助的人:)

thanks to anyone that helps :)

推荐答案

在字符"列值中至少有两行使用NULL,并将表的主键设置为字符"列.

NULL is used in at least two rows for the Character column value and you set the primary key of the table to be the Character column.

根据定义,如果列是主键,则该列的值必须对于所有行都是唯一的.

By definition, if a column is a primary key, then the value of that column must be unique for all rows.

要解决此问题,您需要为每行设置一个唯一的Character值,而该行的Character列值目前为NULL值.

To fix this, you need to set a unique Character value for each row that currently has a NULL value for its Character column value.

这篇关于phpMyAdmin#1062-键'PRIMARY'的重复条目''的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆