Home > database >  The title of an article, content is points in different mysql data table, how to write the mysql sta
The title of an article, content is points in different mysql data table, how to write the mysql sta

Time:10-01

The table first:
As shown in figure: the inside of the table 1 phome_ecms_news: id, every, newspath, titleurl, title, newstime etc fields



Table 2 phome_ecms_news_data_1 there are: id, every, newstext etc fields


Table 3 phome_ecms_news_index there are: id, every, newstime etc fields


The news was the empire CMS above database,
If the collected data in python,
Want to directly use the mysql statement put in storage,
How to write such a mysql statement? Will only write to insert a table statement, a message into three tables at the same time, and there was a phome_ecms_news titleurl is inside the column name/date/id. The HTML, such as:/XXX/2017-12-01/2. The HTML form,

I don't know how to deal with?

CodePudding user response:

A message into three tables, looks like the inside of the SQL standard INSERT a statement can only be inserted into a table, three tables are three INSERT statements; Even if the STORED PROCEDURE, sp, need three INSERT statements,
You need to implement three table data integrity of the transaction is added to it.

CodePudding user response:

Encapsulated with transaction three insert statements

CodePudding user response:

Feel table design has some problems, what will be the same article decomposed into several list? If the content is very big, it have to be like this, we must build a father and son relationship table,
Query, only associated query table of required fields
  • Related