MySQL --- Data addition, deletion, modification and query

adding data

Insert a single tuple

1. Use the SSMS tool to update the data in the data table

2. Use SQL to update the data in the data table

INSERT

VALUES (assign values ​​to the attributes of the new tuple, string constants and time and date should be enclosed in single quotes)

  

Insert multiple tuples

   

Insert tuples via subquery

change the data

 

delete data

Use SQL to delete the data in the data table

Query data

1. Basic query (single table query)

SELECT <field name> FROM <table or view name> Query all data in the table and return all information

SELECT <attribute column to be returned 1> [,<attribute column to be returned 2>] FROM <table name or view name> Query all data in the table and return partial information

SELECT <attribute column to be returned 1> alias 1 [,<attribute column to return 2> alias 2]... FROM <table name or view name> Query all data in the table, return part of the information, change the title display

SELECT TOP N <target column expression> FROM <table name or view name> Query the top N data in the table

SELECT <target column expression> FROM <table name or view name> ORDER BY [ASC|DESC] Query the data in the table and sort it

--ASC is ascending sorting, --DESC is descending sorting (if not specified, the default ascending sorting)

2. Conditional query

3. Range condition query

4. Set condition query

5. Null value condition query

6. Logical condition query

7. Fuzzy query

8. Statistics query

9. Group query

10. Multi-table query

11. Connect query

Cross-connect query

Guess you like

Origin blog.csdn.net/C_huid/article/details/103801664