Flask the superficial application and comprehension of request form + simple SQL statement review

Source: Internet
Author: User

1. Request Form
The knowledge point of the request form is a small part of the Flask data request, first to understand the Get and post requests: http://www.w3school.com.cn/tags/html_ref_httpmethods.asp
Get and post are literally understood, one is "get" one is "send"
Plainly get is a request to obtain data from a specified resource;
and post is to submit the data to be processed to the specified resource;
And our request form, request.form[], is to get the form data submitted in the POST request to our console; A simple example:


And then the app.py, which was built yesterday, writes a function to handle today's request form.
This is because the POST request is used, so only the post is judged and processed, here the print () in parentheses is the last data to be output from the day before the content of the console; the last return page jumps to the login page
The interface has not yet been beautified, take a look at me so comfort myself~~

This is a registration page; After you have set up a login-registered mailbox and password, it can be displayed in the background:

This is just a test to practice the knowledge point, do not consider the practicality first~ ~ Cry
After that, we will see our page jump in the webpage:

At this point we see the final result, only to do here .... Follow-up we began to change the teacher to talk about the database, follow-up I will be using Python to do a more powerful XX page, and so I~~
2. Simple DATABASE Statement revision
Before the course content with the school teacher with the old Sqlsever unloading also unload not clean, left a shadow ... Two days ago installed MySQL, almost did not pretend to be laughed at by classmates, and so I am not small white I do the first thing is to delete your friends ....
Haha, the first two days to install a heidisql, (a MySQL database management client, you can all the operation of MySQL visualization, so we do not have to remember the cumbersome command)
A few simple SQL statements:
1.select "constant/Column name/function/operation/query" from "temporary table (virtual table)/physical table" where "column name 1,," Group BY "the column name of the unique classification attribute" have order by "ascending, descending ..."
Select*from (Select*from tablexxx) uses this example to explain why the from behind is not necessarily just a physical table (stored in the hard disk, open space, is the real storage), there may be virtual tables (not real, It's the data set that you want. The Select*from tablexxx in parentheses is a virtual temporary table;
The order of execution in this order is executed sequentially, the SQL statement is expressed in a different way from the Chinese, the Chinese is "from ... "And SQL is the first to say the adverbial to say from ... Get, the execution order of this sentence is first where after having the order by
The above is only a single table in select, and the table, if possible tomorrow update
2.create known as creating create Table/view
3.insert INSERT statement INSERT into "table name" (column 1,,,) values (,,,)
4.update Modifying/updating Update "table name" set "Column 1,," = new value
5.delete from table name where field name + operator + value
Here the deleted table must be a physical table virtual table is not deleted, it is recommended to use the DELETE statement when you must add where to evade risk;
This is what you learned today ~ ~ ~ I have to go to more practical operation, maybe there will be new cognition

Flask the superficial application and comprehension of request form + simple SQL statement review

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.