数据行操作的相关SQL语句(指令)如下:
- 新增数据
```sql insert into tb1(name,password) values(‘mufeng’,’123123’); insert into tb1(name,password) values(‘mufeng’,’123123’),(‘alex’,’123’);insert into 表名 (列名,列名,列名) values(对应列的值,对应列的值,对应列的值);
insert into tb1 values(‘mufeng’,’123123’),(‘gini’,’123’); — 如果表中只有2列
- [x] **删**除数据
```sql
delete from 表名;
delete from 表名 where 条件;
delete from tb1;
delete from tb1 where name="mufeng";
delete from tb1 where name="mufeng" and password="123";
delete from tb1 where id>9;
- 修改数据
```sql update tb1 set name=”mufeng”; update tb1 set name=”mufeng” where id=1;update 表名 set 列名=值;
update 表名 set 列名=值 where 条件;
update tb1 set age=age+1; — 整型 update tb1 set age=age+1 where id=2;
update L3 set name=concat(name,”db”); update L3 set name=concat(name,”123”) where id=2; — concat一个函数,可以拼接字符串
- [x] **查**询数据
```sql
select * from 表名;
select 列名,列名,列名 from 表名;
select 列名,列名 as 别名,列名 from 表名;
select * from 表名 where 条件;
select * from tb1;
select id,name,age from tb1;
select id,name as N,age, from tb1;
select id,name as N,age, 111 from tb1;
select * from tb1 where id = 1;
select * from tb1 where id > 1;
select * from tb1 where id != 1;
select * from tb1 where name="mufeng" and password="123";