How To Update Database Have Foreign Key And Relation

I have table below





CREATE TABLE r

(

  R_name Varchar(255) NOT NULL,

  R_logo Varchar(255) NOT NULL,

  R_open Time NOT NULL,

  R_close Time NOT NULL,

  R_service Time NOT NULL DEFAULT 130

)

;


ALTER TABLE restaurant ADD PRIMARY KEY (R_name);

ALTER TABLE restaurant ADD UNIQUE R_name (R_name);


CREATE TABLE account

(

  A_user Varchar(255) NOT NULL,

  A_pass Varchar(255) NOT NULL,

  A_name Varchar(255) NOT NULL,

  R_name Varchar(255) NOT NULL

)

;


ALTER TABLE account ADD PRIMARY KEY (A_user);

ALTER TABLE account ADD UNIQUE User (A_user);


-- Create relationships section ------------------------------------------------- 


ALTER TABLE account ADD CONSTRAINT Login FOREIGN KEY (R_name) REFERENCES restaurant (R_name) ON DELETE NO ACTION ON UPDATE NO ACTION;



and when I update table r it must update table account too, how to do?

Use triggers. Refer to the documentation of the database you are using.