Home > database >  Do the two tables, novice what also not, had better give an explanation
Do the two tables, novice what also not, had better give an explanation

Time:10-26

1, set up two tables, one table called DRXD_T1, another for DRXD_T2; To date and well in T1, primary key, a nissan oil, daily fluid, water cut several data items,
Generated by random number and nissan nissan oil liquid, to ensure the nissan oil less than daily fluid; (such as nissan liquid with nissan oil plus a random number);
Generate a month of data;
2, T2 for years, and well, the primary key, data items for the quantity of oil, to produce liquid and water cut;
To produce oil and to produce liquid is nissan's combined during the month, water as the weighted average;
3, given a month and the number of Wells for parameters;
Generated by random string as well, well several provisions of the well; To discharge or pound sign with WELL_1, generate to the specified number of Wells;
Is generated by that month have date, then all well during the month of T1 data;
In accordance with the provisions of 1 described in generating daily data;
These data summary after insert to the T2,
1, set up two tables, one table called DRXD_T1, another for DRXD_T2; To date and well in T1, primary key, a nissan oil, daily fluid, water cut several data items,
Generated by random number and nissan nissan oil liquid, to ensure the nissan oil less than daily fluid; (such as nissan liquid with nissan oil plus a random number);
Generate a month of data;
2, T2 for years, and well, the primary key, data items for the quantity of oil, to produce liquid and water cut;
To produce oil and to produce liquid is nissan's combined during the month, water as the weighted average;
3, given a month and the number of Wells for parameters;
Generated by random string as well, well several provisions of the well; To discharge or pound sign with WELL_1, generate to the specified number of Wells;
Is generated by that month have date, then all well during the month of T1 data;
In accordance with the provisions of 1 described in generating daily data;
These data summary after insert to the T2,
1, set up two tables, one table called DRXD_T1, another for DRXD_T2; To date and well in T1, primary key, a nissan oil, daily fluid, water cut several data items,
Generated by random number and nissan nissan oil liquid, to ensure the nissan oil less than daily fluid; (such as nissan liquid with nissan oil plus a random number);
Generate a month of data;
2, T2 for years, and well, the primary key, data items for the quantity of oil, to produce liquid and water cut;
To produce oil and to produce liquid is nissan's combined during the month, water as the weighted average;
3, given a month and the number of Wells for parameters;
Generated by random string as well, well several provisions of the well; To discharge or pound sign with WELL_1, generate to the specified number of Wells;
Is generated by that month have date, then all well during the month of T1 data;
In accordance with the provisions of 1 described in generating daily data;
These data inserted into the T2 after summary,

CodePudding user response:

Personal think your design is a bit
1, table T1 and T2 table contains well the data items, and you well number is a string (this should be referred to as well), if direct deposit well number of T1 and T2 may cause data inconsistencies, if well of the T1 or T2 one table is modified, then the corresponding relation is wrong, this is in the process of database design to open his table (here the pound sign (well) separate table, increase the ID number well, with the ID is done advocate key, in T1, T2 with well ID do foreign keys),
2, usually the primary key is used by the definition of a meaningless ID primary key,
3, T2 is T1 cyclical statistic, if the statistics function is not used, the existence and necessary, this table, there is no direct use of SQL can query T1 can get data, every time need to query can, of course, often want to use the query function, can be stored in a table, the other can query T2, speed faster, but to the periodic statistical data and record last month in T2, possible problem is the record of T2 if modified, T1 and T2 data is inconsistent,
  • Related