Мы пытаемся удалить все строки, в которых есть данные для имени учетной записи = Banana Republic ....
Пока у нас есть:
Delete Account_T
From Account_T
Join Program_T
Where Account_T.AccountName = Program_T.AccountName
And AccountName = ‘Banana Republic’
Вот таблицы:
create table Program_T
(AccountName varchar(150) not null unique,
ProgramID int not null,
Revenue int,
Advocates int,
Shares int,
Conversions int,
Impressions int,
LaunchDate date,
CSMID int not null,
constraint Program_PK primary key (AccountName, CSMID),
constraint Program_FK1 foreign key (AccountName) references Account_T(AccountName),
constraint Program_FK2 foreign key (CSMID) references CSM_T(CSMID));
и таблица Account_T:
create table Account_T
(AccountName varchar(150) not null unique,
Health varchar(10) not null,
EcommercePlatform varchar(50),
CSMID int not null,
Industry varchar(50),
Amount int not null,
constraint Accounts_PK primary key (AccountName),
constraint Accounts_FK foreign key (CSMID) references CSM_T(CSMID));