[Python] Database Exercise-2

1.     The database is generally used as a storage function, and generally does not require function operations

2.     Insert multiple pieces of data at a time

3.     The method of inserting data into the table:

insert into story_wangjing(id,name) values (1,’wangjing’);

insert into story_wangjing values(2,’lisi’);

insert into story_wangjing values(3,’zhao’),(4,’haha’),(5,’jj’);

4.     Modify multiple values ​​at once

 

 

5.     The data method of the five middle school:

(1)     Manual

(2)     Jmeter , loadrunner, page pressure test

(3)     Operate the database and use Python to insert data into the table

(4)     Datafactory  tools

(5)     Stored procedure (for a single table, the efficiency is the fastest. If the table is related, it is not easy to use if it is more complicated. All logical relationships, foreign keys, and primary keys must be handled)

6. Commonly used functions in     Sql query:

(1) select count(*) from story_wangjing;

(2) select avg(id) from story_wangjing;

(3) select sum(id) from story_wangjing;

(4) select max(id) from story_wangjing;

(5) select min(id) from story_wangjing;

7.     Grouping + Calculation

 

 

8.     Grouping + Average

 

 

9.     After grouping, find a specific field with having

 

 

10.     Query the author information of all authors who have appeared in book_wangjing

 

 

11.     Query all mr.jackson information

 

 

12.     Left join:

 

 

13.     Right join:

 

 

14. Inner join: a.author_name and b.book_author appearing in the result set must exist in both tables at the same time

15. Left join: a.author_name appearing in the result set must exist in the left table (author_wangjing table) and display all

16. Right join: b.book_author that appears in the result set must exist in the right table (book_wangjing table) and display all

 

 

17.     union : For merging, when using union, the data columns of the coordinates should be as many as the data columns of the right table

 

 

18.     Calculate the current time:

 

19.     Tomorrow:

 

20.     Yesterday

 
 
21. Next month
 

 

22. Last month
 
 
23. Next year
 
24. Last year
 
25. Increase time
 

26.     Format reference

Interval Name Description

Second    seconds

Minute    _

Hours      _

Day       _

Month     _

Year      _

Minute_second    minutes and seconds, separated by ":"

Hour_second  hours, minutes and seconds, separated by ":"

Year_month   year and month, separated by "-"

27.     Reduce time:

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325069696&siteId=291194637