Table 1, Table 2, Table 3 are made like this, and when you calculate table 1 and 2 data and insert it into table 3, it is too difficult to make it into sql statements. 프로그래 I'm going to make the necessary data through programming and put it in table 3 I wonder how to do it in practice.
Example 1) When an event occurs, calculate table 1 and 2 as sql statements as inner join and condition result value
insert table 3 into (a,b,c,d)
Select table 1 value * table 2 value from table 1 inner join table 2 on condition = condition
Interfering... ...Working only with pure sql statements and inserting them into table 3
or
Example 2) Place the necessary table values with the select statement, process them using Python, and save them as a list
Saved lists or variables, etc...
Module.exe (insert into table 3 (a,b,c,d) values ({},{},{}).format(a,b,c,d))
module.commit
Python, insert using the corresponding db module
I can do it with example number 2, but I don't know much about the sql statement yet, so it's faster if I make it with the sql statement? I think it'll be convenient to take care of. I don't think it's standard? I'm asking you a question.
sql python
We use both methods in practice. The advantage of the first method is that it is easy to enter multiple records with a single insert syntax or without data processing on the server side.
There's no such thing as a standard. Maybe it's not a pysonic way? Wouldn't there be a smarter way? If that's what I'm saying, sql is not python.
Of course, the om module allows you to work on the database without having to write a query directly, but since om is also converted to sql, sql is performed, which is a big difference from knowing sql.
I recommend that you take the time to study the database.
© 2024 OneMinuteCode. All rights reserved.