Back to the fourth day of javaweb (2)

 

 

 

 

 

 This is the record operation in the lookup table in DQL.

 

 

 In this case, it is the operation of insert

If all columns are inserted, you can not specify the column name

 

 

 

Here is how to delete the records in the table.

DELETE FROM directly add table name

 

 If you delete all the records in the table, then use the sentence TRUNCATE table

Remember: to operate on the records in the table, generally do not add the table keyword, only truncate to add, because it is for the entire table, understandable

For inserts, the TABLE keyword is not added.

For create table and create table, only the desc directly adds the table name without the table keyword, the other requires the table keyword

Select database () and the like, are to add the database keyword, in addition to use a database, use USE XXX directly

Others must add the database keyword.

 

This is the definition of the keywords of table and database in three levels.

 

 

 

 Here is the update operation, how to change the value of the record inside.

If no conditions are added, everything in the table will be modified.

 

 Add columns in mysql, even if you add multiple columns, you need to write a mysql statement.

Like here, we separated two statements to add columns.

 

 After making changes directly in sqlyog, refresh and save.

 

 A combination of high to low and low to high.

Here I will teach you how to sort the fields. The sorting must come from an operation in the select. It must be a query before querying.

 

 

 

 

 

 If you query now, you will know if you are counting if it is empty.

 

 For *, as long as one line of data is not null, even a record, because * means all

For the company, if you want to count records, then you should go to select count (primary key) from the table

Reason: The primary key must not be empty. It must be the most accurate to calculate the primary key. Calculate the number of times if the primary key is not empty.

 

 There is nothing to say about other aggregate functions, remember one thing: it must be calculated on the column

 

 If you insert something wrong in sqlyog and don't know why, then use refresh and restore it without saving.

 

 

 

 

 

 

 

 

 

 

 Here is about grouping, and that grouping is only met if the XX condition is met, and that the result display after grouping will know by yourself

Just use where and having to know when they are, and having and group by are two differences.

 

 

 

 Now I will be an alias, and I will be aggregator.

 

 

 

 

 

 In other words, the paging operations in different databases are different.

 

 

 

 

 

 

 

 

 

 

Remember: the object of the select operation is also a column object, so select the column object from xxx

Then, if the column object is the sum of two columns, then the two column names are added together.

 

 

 

Guess you like

Origin www.cnblogs.com/startFrom0/p/12702618.html
Recommended