1. Retrieving data
A query is a way to extract information from a database. Structured Query Language (SQL) is the standard relational database query language.
Data is stored in a table (row), which is made up of columns (column).
(1) The simplest form of inquiry consists of two parts: the select list, which specifies the column to retrieve, and the FROM clause, which specifies the table to be accessed.
Select CustomerName from CustomerInfo
(2) The WHERE clause specifies the criteria for selecting a data row.
SELECT * from customerinfo where CustomerID = 48
(3) The ORDER BY clause can sort the data in some order, based on one or more columns.
SELECT * from CustomerInfo where State = 4 ORDER by Regtime DESC
2. Inserting data
The second important task is to add data to the database (for example, insert several rows). You can use the INSERT statement to complete.
Insert into CustomerInfo (Customername,[password],email,compname, [State],regtime) VALUES (' APPLE ', ' 123456 ', ' [Email Protected] ', ' APPLE ', 4, ' 2014-12-25 ')
3. Updating data
The third important task is to modify the data. You can do this by using the UPDATE statement.
Update ProjectInfo Set state = 4 where CustomerID = 48
4. Delete data
The last important task is to delete the data. You can do this by using the DELETE statement. Delete Deletes the entire row of data.
Delete from CustomerInfo where CustomerID = 90
In summary, it is the most basic crud operation.
Section II Manipulating Database data