简体   繁体   English

此查询有什么问题? 我正在尝试创建一个具有一些主要ID的练习小表格来进行匹配,但我在这里找不到错误

[英]What is the problem with this query? I am trying to create a practice small table with some primary id to do matching but I don't find the error here

Small table to practice id matching. 小表格练习ID匹配。

CREATE DATABASE test_1;
USE test_1;

CREATE TABLE test_items(

contact_id INT NOT NULL AUTO_INCREMENT,
first_name VARCHAR (20) ,
last_name VARCHAR (20),
PRIMARY KEY (contact_id)
);

INSERT INTO test_items()

VALUES (
(NULL, 'Javier','Droid'),
(NULL,'Gret','Jun'),
(null,'Kilot','Ramirez')

);
SELECT * FROM test_items;

Always specify the column names you are inserting: 始终指定要插入的列名:

INSERT INTO test_items(first_name, last_name)  
VALUES ('Javier','Droid'), ('Gret','Jun'), ('Kilot','Ramirez'); 

SELECT * FROM test_items;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如果id1是表t1中的主键。 我想创建新表t2并将t1中的id1用作t2中的外键。 我应该查询什么? - If id1 is primary key in table t1. And I want to create new table t2 and use id1 in t1 as foreign key in t2. What should be my query? 我试图从MySQL查询生成一个HTML表。 这是我试图从MySQL查询生成的表的格式: - I am trying to generate an HTML table from a MySQL query. Here is the format of the table I am trying to generate from a MySQL query: 我不知道我到底要找什么 - I don't know exactly what I'm trying to find 我正在尝试将一些数据插入状态表,但在 Laravel 中出现 SQL 查询错误 - I am trying to insert some data into status table but getting SQL Query Error in Laravel MySQL 说“with”对这个 position 无效。 我不明白这里的问题是什么,因为语法似乎是正确的 - MySQL say “with” is not valid for this position. I don't understand what the problem here is since the syntax seems to be correct 我在 mysql 的 function 中遇到问题,这是查询 - i am having a problem with not in function in mysql, here is the query 我无法弄清楚这里有什么问题 - I am not able to figure out what's the problem here 尝试将数据获取或发布到mySQL数据库时,在LOOPBACK中出错。 我在这里想念的是什么? - Getting error in LOOPBACK when trying to GET or POST data to mySQL db. What I am missing here? 我在尝试在phpmyadmin中创建表时遇到错误 - I am getting an error trying to create table in phpmyadmin 如何从两个表中查询匹配表中的外键和另一个表中的主键 - How do I query from two tables matching the foreign key from table with the primary key from another
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM