SQL language is divided into four categories: data query language DQL, data manipulation language DML, data definition language DDL, and data control language DCL.
1. Data query language DQL
The basic structure of data query language DQL is a query block composed of SELECT clause, FROM clause and WHERE clause:
SELECT
FROM
WHERE
2. Data manipulation language DML
Data manipulation language DML mainly has three forms:
1) Insert: INSERT
2) Update: UPDATE
3) Delete: DELETE
3. Data Definition Language DDL
Data Definition Language DDL is used to create various objects in the database ----- tables, views, indexes, synonyms, clusters, etc. such as:
DDL operations are submitted implicitly! Cannot rollback
4. Data Control Language DCL
Data Control Language DCL is used to grant or revoke certain privileges to access the database, and to control the time and effect of database manipulation transactions. Monitor the database, etc. Such as:
1) GRANT: Authorization.
2) ROLLBACK [WORK] TO [SAVEPOINT]: Roll back to a certain point.
Rollback---ROLLBACK
The rollback command returns the database state to the last submitted state. The format is: SQL>ROLLBACK;
3) COMMIT [WORK]: Submit.
During database insertion, deletion and modification operations, the transaction is completed only when it is submitted to the database. Before the transaction is committed, only the person operating the database has the right to see what has been done. Others can only see it after the final commit is completed.
There are three types of submitted data: explicit submission, implicit submission and automatic submission.
These three types are described below.
(1) Explicit submission
The submission completed directly using the COMMIT command is an explicit submission. The format is: SQL>COMMIT;
(2) Implicit submission
Submit completed indirectly using SQL commands is implicit submission. These commands are:
If AUTOCOMMIT is set to ON, the system will automatically submit after the insert, modify, and delete statements are executed. This is automatic submission.
The format is: SQL>SET AUTOCOMMIT ON;
##
The above is the detailed content of What are the types of database operations?. For more information, please follow other related articles on the PHP Chinese website!
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
Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps
Hibernate polymorphic mapping can map inherited classes to the database and provides the following mapping types: joined-subclass: Create a separate table for the subclass, including all columns of the parent class. table-per-class: Create a separate table for subclasses, containing only subclass-specific columns. union-subclass: similar to joined-subclass, but the parent class table unions all subclass columns.
To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.
How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())
Using the database callback function in Golang can achieve: executing custom code after the specified database operation is completed. Add custom behavior through separate functions without writing additional code. Callback functions are available for insert, update, delete, and query operations. You must use the sql.Exec, sql.QueryRow, or sql.Query function to use the callback function.
JSON data can be saved into a MySQL database by using the gjson library or the json.Unmarshal function. The gjson library provides convenience methods to parse JSON fields, and the json.Unmarshal function requires a target type pointer to unmarshal JSON data. Both methods require preparing SQL statements and performing insert operations to persist the data into the database.
Through the Go standard library database/sql package, you can connect to remote databases such as MySQL, PostgreSQL or SQLite: create a connection string containing database connection information. Use the sql.Open() function to open a database connection. Perform database operations such as SQL queries and insert operations. Use defer to close the database connection to release resources.