Home > Database > Mysql Tutorial > body text

What data operations does mysql have?

PHPz
Release: 2023-05-26 20:19:04
forward
1443 people have browsed it

1. Read data

select * from tb1;
select count(*) from tb1; #获取数据库条数  count(1)效果相同,效率更高
Copy after login

2. Insert data

INSERT INTO table_name ( field1, field2,...fieldN )
VALUES
( value1, value2,...valueN );
Copy after login

3. Update data

UPDATA tb1 SET name='li' where id=3;
UPDATA tb1 SET name=default where id=2; #将名字赋予默认值
Copy after login

4. Delete data

DELETE FROM tb1 where id=1;
Copy after login

5. Where condition query

select * where name='luo';
select * where BINARY name ='luo';  //数据库默认是不区分大小写的  用 BINARY来强调大小写
Copy after login

6. Like combined with regular expressions to query

SELECT * from tbl WHERE name LIKE '%o'; 查找所有名字由 o 结尾的记录
Copy after login

The above is the detailed content of What data operations does mysql have?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!