MySQL - 4. SQL增删改查

 

insert into player values(1,'name','other');
insert into player (name,club) values ('abc','123');
外键关联查询示例:
c.* 查询的范围
player p,club c关联的两表,分别取名
p.club_id=c.id 条件1
p.name='梅西' 条件2
select c.* from player p,club c where p.club_id=c.id and p.name='梅西';
原始语句:
select club.club_name from player,club where player.club_id=club.id and player.name='梅西';

 

 

删除指定行数据
delete from onposition where id=14;

 

修改表里对应的值
update player set name='leo' where id = 1;

 

select * from player;
select * from player order by id;
select name,country form player;

 

posted @ 2020-09-10 00:31  短戈行  阅读(178)  评论(0编辑  收藏  举报