delete from customerinfo
where customerid not in (select customerid from salesinfo )
select * from customerinfo
where customerid not in (select customerid from salesinfo )
select * from customerinfo
left join salesinfoon customerinfo.customerid=salesinfo.
customerid
where salesinfo.customerid is null
select name, phone from client
union
select name, birthdate from author
union
select name, supplier from product
begin;
insert into salesinfo set customerid=14;
update inventory set quantity=11
where item='book';
commit;
lock table inventory write
select quantity from inventory
whereitem='book';
...
update inventory set quantity=11
whereitem='book';
unlock tables
create table customerinfo
(
customerid int not null ,
primary key ( customerid )
) type = innodb;
create table salesinfo
(
salesid int not null,
customerid int not null,
primary key(customerid, salesid),
foreign key (customerid) references customerinfo
(customerid) on deletecascade
) type = innodb;
select * from order where year(orderdate)<2001;
select * from order where orderdate<2001-01-01;
select * from inventory where amount/7<24;
select * from inventory where amount<24*7;
