Home > Database > Mysql Tutorial > How to write conditional statements for addition, deletion, modification and query of SQL database information? (example)

How to write conditional statements for addition, deletion, modification and query of SQL database information? (example)

藏色散人
Release: 2019-05-11 17:54:49
Original
4361 people have browsed it

This article mainly summarizes and introduces the addition, deletion, modification and query statements of the database. Everyone should know that SQL is the standard computer language used to access and manipulate databases. What are its main functions?
You can query the database, insert data into the database, update data in the database, delete data in the database, and add new data to the database.
(Database) is a warehouse that organizes, stores and manages data according to the data structure. With the development of information technology and market, data management is no longer just about storing and managing data, but transforming into various data needed by users. way of management.
The following is an example of adding, deleting, modifying and querying SQL statements:
1. Adding commonly used SQL adding, deleting, modifying and querying statements: insert into data table (field 1, field 2, field 3) values ​​(value 1, value 2, value 3 )

String sql="insert into employees(id,username,age) values(22,2,2)";
Copy after login

2. Deletion of sql statement additions, deletions and modifications: delete from data table where id=received ID parameter

String sql2="delete from employees where id=22";
Copy after login

  How to write conditional statements for addition, deletion, modification and query of SQL database information? (example)

3. sql table Modification of add, delete, modify and query: update data table set field 1=value 1, field 2=value 2 where id=received ID parameter

String sql3="update employees set username='zhang',age='2222' where id=1";
Copy after login

4. Query

String sql4="select * from employees where id=1";
Copy after login

The above is an introduction to the specific statements about addition, deletion, modification and query of sql database. I hope friends in need will have some knowledge about adding, deleting and modifying SQL statements.


The above is the detailed content of How to write conditional statements for addition, deletion, modification and query of SQL database information? (example). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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