I'm trying to create some tables in Oracle LiveSQL and I'm getting ORA-00922: missing or invalid option but I can't figure it out why it doesn't work; here is the code(the comments stand for the tables in the relational model).I apologize for eventual stupid mistakes, I'm a complete beginner of SQL programming.
/* Base di dati
KEYWORD(codice, nome)
UTENTE(CF, nome, cognome, email)
ANNUNCIO(codice, categoria, nome, descrizione, data_pubblicazione, data_scadenza, prezzo, comune, di_persona, tipo, CFUtente)
OFFERTA(CFutente, data, ora, importo, note, codice_annuncio)
INCLUSIONE(codice_keyword, codice_annuncio)
*/
/*
KEYWORD(codice, nome)
*/
create table keyword
(codice char(4) primary key,
nome varchar(20)
)
/*
UTENTE(CF, nome, cognome, email)
*/
create table utente
(CF char(16) primary key,
nome varchar(20),
email varchar(20)
)
/*
ANNUNCIO(codice, categoria, nome, descrizione, data_pubblicazione,
data_scadenza, prezzo, comune, di_persona, tipo, CFUtente)
*/
create table annuncio
(codice char(10) primary key,
categoria varchar(11),check(categoria in
('elettronica','immobili','veicoli','altro')),
nome varchar(20),
desc varchar(100),
data_pubb date,
data_scad date,
prezzo float,
comune varchar(20),
di_persona boolean,
tipo varchar(8),check(tipo in ('vendita','acquisto')),
CFutente char(16) references utente(CF),
check((tipo = 'vendita' AND di_persona is null) or (tipo = 'acquisto' and
prezzo is null and comune is null))
)
/*
OFFERTA(CFutente, data, ora, importo, note, codice_annuncio)
*/
create table offerta
(CFutente char(16) references utente(CF),
data date,
ora time,
importo float,
note varchar(100),
codice_annuncio char(10) references annuncio(codice),
primary key(CFutente,data,ora),
check(CFutente <> (SELECT CFutente FROM annuncio WHERE
codice=codice_annuncio))
)
/*
INCLUSIONE(codice_keyword, codice_annuncio)
*/
create table inclusione
(codice_keyword char(4) references keyword(codice),
codice_annuncio char(10) references annuncio(codice),
primary key(codice_keyword,codice_annuncio)
)