Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/57.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 创建包含具有唯一字符串的列的表_Mysql_Sql - Fatal编程技术网

Mysql 创建包含具有唯一字符串的列的表

Mysql 创建包含具有唯一字符串的列的表,mysql,sql,Mysql,Sql,我想创建一个包含5行的列,每个列都有一个唯一的字符串。 例如,我想要这样的东西 水果 实际上,这是一个非常简单的问题,每个教程都会教你如何去做。只要谷歌就可以了。无论如何,要创建表,请使用以下代码: CREATE TABLE `fruit` ( `title` text NOT NULL, PRIMARY KEY (`title`), ); INSERT INTO fruit (`title`) VALUES (`banana`), (`apple`),

我想创建一个包含5行的列,每个列都有一个唯一的字符串。 例如,我想要这样的东西

水果
实际上,这是一个非常简单的问题,每个教程都会教你如何去做。只要谷歌就可以了。无论如何,要创建表,请使用以下代码:

CREATE TABLE `fruit` (
  `title` text NOT NULL,
  PRIMARY KEY (`title`),
  );
INSERT INTO fruit
    (`title`)
VALUES
    (`banana`),
    (`apple`),
    (`orange`),
    (`strawberry`),
    (`pineapple`);
以及用于插入数据的以下代码:

CREATE TABLE `fruit` (
  `title` text NOT NULL,
  PRIMARY KEY (`title`),
  );
INSERT INTO fruit
    (`title`)
VALUES
    (`banana`),
    (`apple`),
    (`orange`),
    (`strawberry`),
    (`pineapple`);

学习MySQL和编程的基础知识,玩得开心

你能做到的。问题是什么?如果可能的话,我想要代码,谢谢!