Create a web application to keep track of friends’ birthdays.
In app.py, you’ll find the start of a Flask web application.
The application has one route (/)
-> that accepts both POST requests (after the if)
-> and GET requests (after the else).
Currently, when the / route is requested via GET,
the index.html template is rendered.
When the / route is requested via POST,
the user is redirected back to / via GET.
birthdays.db is a SQLite database with
one table, birthdays, that has four columns:
-> id, name, month, and day.
There are a few rows already in this table, ultimately your web application will support
-> the ability to insert rows into this table!
No need to edit the CSS
<---->
When the / route is requested via GET, your web application should
-> display, in a table, all of the people in your database
-> along with their birthdays.
-> First, in app.py,
-> Then, in index.html,
3. add logic to render each birthday as a row in the table.
Each row should have two columns:
When the / route is requested via POST, your web application should
-> add a new birthday to your database
-> and then re-render the index page.
-> First, in index.html,
-> Then, in app.py,
add logic in your POST request handling to INSERT a new row into the birthdays table based on the data supplied by the user.
Implement a website via which users can “buy” and “sell” stocks
A web app via which you can manage portfolios of stocks
Table in a database is a two-dimensional set of rows and columns,
columns = properties = columns
rows = instances of entity in table
You can insert multiple rows at a time by just listing them sequentially.
Insert statement with values for all columns
INSERT INTO mytable
VALUES (value_or_expr, another_value_or_expr, …),
(value_or_expr_2, another_value_or_expr_2, …),
…;
INSERT INTO Customers (CustomerName, City, Country)
VALUES ('Cardinal', 'Stavanger', 'Norway');
Insertion of Specific Columns
INSERT INTO mytable
(column, another_column, …)
VALUES (value_or_expr, another_value_or_expr, …),
(value_or_expr_2, another_value_or_expr_2, …),
CREATE TABLE purchase (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
username TEXT NOT NULL,
symbol TEXT NOT NULL,
total_price NUMERIC NOT NULL,
share_quantity NUMERIC NOT NULL,
share_price NUMERIC NOT NULL
);