mysql数据库删除数据语句怎么写
展开全部
方法/步骤
查询数据:select * from xxx;
例子:
(1)select id,username,password from t_user;
(2)select id,username,password,gender from t_user where gender = '男';
(3)select id,username,password,gender from t_user where gender is null;
添加数据:insert xxx(id, username) values(xx, "xxx");
例子:
insert into t_user(id, username) values(10, "hehehe");
insert into t_user(id, gender, username, age, password) values(15, '男', 'shihu', 18, '123456');
insert into t_user values(16, 'benladeng', '123456', '拉登', 'nan', 18);
修改数据:update tablename set xx=xx,xxx=xx where xxx=xxx and xxx=xxx;
删除数据:delete from tablename where xx=xxx and xxx = xxx or xxx = xxx;
DQL数据查询语言
连接查询
左外连接
select
e.name ename,
e.gender,
d.name dname
from
t_employee e left outer join t_department d
on
e.depart_id = d.id
6
设置数据库可以被其他计算机连接
打开名为mysql的数据库 --> user表 --> 将root的host改为% --> 提交 --> 重启mysql服务即可。
查询数据:select * from xxx;
例子:
(1)select id,username,password from t_user;
(2)select id,username,password,gender from t_user where gender = '男';
(3)select id,username,password,gender from t_user where gender is null;
添加数据:insert xxx(id, username) values(xx, "xxx");
例子:
insert into t_user(id, username) values(10, "hehehe");
insert into t_user(id, gender, username, age, password) values(15, '男', 'shihu', 18, '123456');
insert into t_user values(16, 'benladeng', '123456', '拉登', 'nan', 18);
修改数据:update tablename set xx=xx,xxx=xx where xxx=xxx and xxx=xxx;
删除数据:delete from tablename where xx=xxx and xxx = xxx or xxx = xxx;
DQL数据查询语言
连接查询
左外连接
select
e.name ename,
e.gender,
d.name dname
from
t_employee e left outer join t_department d
on
e.depart_id = d.id
6
设置数据库可以被其他计算机连接
打开名为mysql的数据库 --> user表 --> 将root的host改为% --> 提交 --> 重启mysql服务即可。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询