SQL is an advanced non-procedural query language. You can use it to perform database operations and regard SQL as a tool for communication between the client and the server.
SQL is an advanced non-procedural query language. You can use it to perform database operations and regard SQL as a tool for communication between the client and the server.
SQL is an advanced non-procedural query language. You can use it to perform database operations.
The SQL language can be seen as a tool for communication between the client and the server to access, query, and update relational database systems.
Insert statement
The syntax structure of the INSERT statement is as follows:
The table Value refers to the name of the table to be inserted, Column refers to the name of the Column to be inserted, and Value refers to the specific data Value to be inserted.
For example, to insert a new member data into the member table, you can add it as follows:
The advantage of the former is that you can specify which fields to add data. The disadvantage is that the field names in parentheses after the table names must be compared with the Value values.
The latter has the advantage of being easy to write, but has the disadvantage of assigning values to all fields in the Value.
When a data packet needs to be inserted with NULL values, the first method is generally used, while the second method needs to be filled with the NULL keyword for insertion.
If the inserted data contains the time and the time is the current time,
If the insert time is a specific time, we can modify the preceding statement as follows:
All the preceding operations are single-row data, while the following operations are multi-row data.
An example of inserting multiple rows of data is as follows:
UPDATE statement
The UPDATE statement structure is as follows:
For example, Initialize all member passwords:
Conditional update:
When performing the update operation, the WHERE condition generally selects a field with unique constraints such as the primary key, unless in special circumstances,
Otherwise, unexpected misoperations may occur. For example, it is very dangerous to update a user table with name as the condition,
Because the names can be repeated.