Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
SQL question?
CREATE TABLE user
(
userName varchar(50) NOT NULL,
password varchar(30) NOT NULL,
PRIMARY KEY (userName)
) ;
CREATE TABLE lista
(
userName varchar(50) NOT NULL,
listaName varchar(200) NOT NULL,
listaDescription Text,
PRIMARY KEY (userName, listaName),
FOREIGN KEY (userName) REFERENCES user (userName)
ON DELETE CASCADE
ON UPDATE CASCADE
);
CREATE TABLE todo
(
listaName varchar(200) NOT NULL,
todoDescription varchar(100) NOT NULL,
active varchar(3) NOT NULL,
PRIMARY KEY (listaName,todoDescription ),
FOREIGN KEY (listaName) REFERENCES lista (listaName)
ON DELETE CASCADE
ON UPDATE CASCADE
);
Is giving me an ERROR 1005 and is not creating
"myDB.todo"
it creates the first two tables but then it gives me an error for the third one
isn't the space...:)
I am already using the database, under the user that I create for it... uhm and then I log in as that user and start creating this tables....
I change the name "Active" to another, still not working
4 Answers
- Serge MLv 61 decade agoFavorite Answer
Foreign key must reference ONLY on UNIQUE/PRIMARY KEY constraints. So
CREATE TABLE todo
(
userName varchar(50) NOT NULL,
listaName varchar(200) NOT NULL,
todoDescription varchar(100) NOT NULL,
active varchar(3) NOT NULL,
PRIMARY KEY (listaName,todoDescription ),
FOREIGN KEY (userName,listaName) REFERENCES lista (userName,listaName)
ON DELETE CASCADE
ON UPDATE CASCADE
);
will work.
- Anonymous1 decade ago
I dont see any reference to a database name or
setting a WIN login or SQL account access
where exactely do you expect this table to be defined?