gpt4 book ai didi

MySQL SELECT WHERE PERSON_NAME = 函数不工作

转载 作者:太空宇宙 更新时间:2023-11-03 10:32:48 26 4
gpt4 key购买 nike

所以我正在尝试 SQL 并逐步自学,但由于某种原因,这不起作用。我得到的只是表内容名称,将弹出一个网格,在 MySQL 的网格框中显示“PERSON_NAME PERSON_SURNAME BIRTH_PLACE BIRTH_DATE YEARLY_WAGE PERSON_AGE 但不是我插入其中的值。这是代码

CREATE TABLE PEOPLES (
PERSON_NAME VARCHAR(50) NOT NULL,
PERSON_SURNAME VARCHAR(50) NOT NULL,
BIRTH_PLACE VARCHAR(50) NOT NULL,
BIRTH_DATE date NOT NULL,
YEARLY_WAGE INT (50) NOT NULL,
PERSON_AGE INT (50) NOT NULL
);
INSERT INTO PEOPLES (PERSON_NAME, PERSON_SURNAME, BIRTH_PLACE, BIRTH_DATE, YEARLY_WAGE, PERSON_AGE)
VALUES ("Trollfire", "Lolmay", "Montenegro", 29042000, 600000, 19);
INSERT INTO PEOPLES (PERSON_NAME, PERSON_SURNAME, BIRTH_PLACE, BIRTH_DATE, YEARLY_WAGE, PERSON_AGE)
VALUES ("Thomas", "Trainson", "Albania", 17091964, 100000, 60);
INSERT INTO PEOPLES (PERSON_NAME, PERSON_SURNAME, BIRTH_PLACE, BIRTH_DATE, YEARLY_WAGE, PERSON_AGE)
VALUES ("Stefan", "Savic", "Serbia", 19021972, 234567, 25);
INSERT INTO PEOPLES (PERSON_NAME, PERSON_SURNAME, BIRTH_PLACE, BIRTH_DATE, YEARLY_WAGE, PERSON_AGE)
VALUES ("Milo", "Djukanovic", "Croatia", 999999, 01011922, 70);
INSERT INTO PEOPLES (PERSON_NAME, PERSON_SURNAME, BIRTH_PLACE, BIRTH_DATE, YEARLY_WAGE, PERSON_AGE)
VALUES ("Vladimir", "Putin", "Russia", 444444, 11121933, 62);
INSERT INTO PEOPLES (PERSON_NAME, PERSON_SURNAME, BIRTH_PLACE, BIRTH_DATE, YEARLY_WAGE, PERSON_AGE)
VALUES ("Cristiano", "Ronaldo", "France", 777777, 03031993, 34);
INSERT INTO PEOPLES (PERSON_NAME, PERSON_SURNAME, BIRTH_PLACE, BIRTH_DATE, YEARLY_WAGE, PERSON_AGE)
VALUES ("Lionel", "Messi", "Spain", 101010, 10101910, 40);
SELECT * FROM PEOPLES
WHERE PERSON_NAME = "Vladimir";

最佳答案

您的日期文字不正确,可能是插入语句中的其他问题。这是一个语法有效的版本:

INSERT INTO PEOPLES (PERSON_NAME, PERSON_SURNAME, BIRTH_PLACE, BIRTH_DATE,
YEARLY_WAGE, PERSON_AGE)
VALUES
('Trollfire', 'Lolmay', 'Montenegro', '2000-04-29', 600000, 19);

Demo

请注意,字符串文字通常应使用单引号而不是双引号。另外,see the MySQL documentation用于有效的日期文字格式。

关于MySQL SELECT WHERE PERSON_NAME = 函数不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54566815/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com