MySQL Forums
Forum List  »  Newbie

Re: How to refresh contents of a child table...
Posted by: Peter Brawley
Date: October 31, 2018 07:22PM

First, the schema design needs work: titles:actor is many:many, so lose titles.actor; likewise lose actors.movie.

Second, Windows is case-insensitive, the rest of the computer world isn't, so don't capitalise identifier names, leave them lower case so the db can be ported to a non-Windows environment.

And btw some titles & names (esp. non-anglo names) are much longer than 50 chars.

So we have ...

drop table if exists movies,actors,titles;
create table titles ( 
  title varchar(128) primary key, 
  genre varchar(32) not null  
); 

create table actors( 
  name varchar(128) primary key 
);

create table movies ( 
  title varchar(128) references titles(title), 
  genre varchar(15) references titles(genre), 
  actorname varchar(128) references actors(name) 
); 
drop table movies,actors,titles;


And, relationships don't auto-update. You have to write the updates.

Options: ReplyQuote


Subject
Written By
Posted
Re: How to refresh contents of a child table...
October 31, 2018 07:22PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.