2012-03-22 16 views
5

Ecco una tabella Studente ho codificato in PostgreSQL (un estratto):Messaggio di errore quando si utilizza INSERT INTO

CREATE TABLE "Student" 
(
    ucas_no integer NOT NULL, 
    student_name character(30) NOT NULL, 
    current_qualification character(30), 
    degree_of_interest character(30), 
    date_of_birth date NOT NULL, 
    street_address character(30) NOT NULL, 
    city character(30) NOT NULL, 
    post_code character(10) NOT NULL, 
    country character(20) NOT NULL, 
    phone_no character(15) NOT NULL, 
    gender character(6) NOT NULL, 
    user_name character(15) NOT NULL, 
    "password" character(30) NOT NULL, 
    CONSTRAINT pk_ucas_no PRIMARY KEY (ucas_no), 
    CONSTRAINT ten_digits_only CHECK (length(ucas_no::character(1)) >= 10 OR length(ucas_no::character(1)) <= 10) 
) 

ora sto usando la funzione di strumento di query di pgAdmin per inserire i dati nella tabella. Ecco il codice di INSERT INTO ...

INSERT INTO Student 
VALUES 
('912463857', 'Jon Smith', 'A-Level', 'BSc(Hons) Computer Science', '10/06/1990', '50 Denchworth Road', 'LONDON', 'OBN 244', 'England', '02077334444', 'Male', 'jonsmi', '123456'); 

Il problema che sto avendo è, Ricevo un messaggio di errore che la tabella di Student non esiste, quando è chiaramente nella mia databse. Ecco il messaggio di errore:

ERROR: relation "student" does not exist 
LINE 1: INSERT INTO Student (ucas_no, student_name, current_qualific... 
        ^

********** Error ********** 

ERROR: relation "student" does not exist 
SQL state: 42P01 
Character: 13 

Qualcuno ha un'idea di cosa c'è che non va?

+0

Anche nel codice INSERT INTO è importante che i dati vengano racchiusi tra virgolette singole o no? Vedo che alcuni codici hanno citazioni singole e altri no. –

risposta

7

aver creato una tabella "Student" e si sta cercando di inserire in una tabella chiamata Student che sono diversi

provare questo

INSERT INTO "Student" VALUES('912463857', 'Jon Smith', 'A-Level', 'BSc(Hons) Computer Science', '10/06/1990', '50 Denchworth Road', 'LONDON', 'OBN 244', 'England', '02077334444', 'Male', 'jonsmi', '123456'); 

Ciò funzionerà

prega di passare attraverso questo circa qoutes omitting-the-double-quote-to-do-query-on-postgresql

+0

Grazie PresleyDias. Ora funziona. Anche grazie per il link, alcune buone informazioni in là. –

2

Cercare "identificatore quotato" in "4.1.1. Identifiers and Key Words".

Per quanto riguarda la seconda domanda (non commentare le vostre domande, modificarle se correlate, creare nuove se non) - leggere l'intero "Chapter 4. SQL Syntax" del manuale, ma il minimo indispensabile è "4.1.2. Constants".

+0

Grazie. Lo guarderò e tornerò da te se avessi qualche problema. –

Problemi correlati