473,418 Members | 2,293 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

Programming

1
If multiple tables have the same fields, what is a good way to do synchronous updates? For example, the user name field of the order data table, the user mobile number field, needs to be updated as the field of the user table is updated
May 11 '22 #1
1 7334
zmbd
5,501 Expert Mod 4TB
Hello Livre
Welcome to Bytes...
You've provided precious little for us to work with, are the relationships setup between the tables on these fields, etc...
Take a look at MySQL UPDATE Statement
See if that's on the right path.... personally I've never had to update across multiple tables with a mysql database... (read on to see why)

However, from what you do provide, at first read, it sounds to me like your database is not normalized (see link)
> Database Normalization and Table Structures.
If this is the case, your very first step SHOULD be to start normalizing your database - it is a pain, it is well worth every second you put in to do so as a DBA because doing so will save weeks and months of time in developing views/queries and maintaining the overall data integrity.

Normalizing your data would make updates like what I think you asking about very simple; for example (please ignore spelling):
Expand|Select|Wrap|Line Numbers
  1. VERY Simple Example
  2. [tbl_employ]
  3. [PK_Customer][FamilyName][FirstName]
  4. [1          ][Doe       ][John        ]
  5. [2          ][Smith     ][Shellie     ]
  6.  
  7. [tbl_Telephone]
  8. [PK_Info][FK_Employ   ][Telephone]
  9. [1      ][1           ][555-555-0001]
  10. [2      ][1           ][555-555-0002]
  11. [3      ][1           ][555-555-0003]
  12. [4      ][2           ][555-555-9001]
  13. [5      ][2           ][555-555-9002]
  14. [6      ][2           ][555-555-9003]
"PK " indicates the primary key, this is unique to the record and ideally has nothing related to the record data
"FK " indicates a foreign key which points back to a record in a related table
The relationship is one-to-many between [tbl_employ] and [tbl_Telephone] on the fields
[tbl_employ]![PK_Customer] and [tbl_Telephone]![FK_Employ]
(if you don't understand this, please see the link above covering normalization)

Say we publish a report with each employ's name and telephone numbers and "Shellie" informs us that the first name is misspelled and should be "Shelly"!
Now with a normalized database we only need to go to [tbl_employ] and edit one record and reprint.
HOWEVER
Say that in [tbl_Telephone] we had added fields for [FamilyName] and [FirstName] then we would not only have to edit the record in [tbl_employ] but also three records in [tbl_Telephone]
May 11 '22 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Martin | last post by:
When was inheritance intruduced into object oriented programming? More generally, does anyone know or have any sources on when the different features were introduced into object oriented...
12
by: G. | last post by:
Hi all, During my degree, BEng (Hons) Electronics and Communications Engineering, we did C programming every year, but I never kept it up, as I had no interest and didn't see the point. But now...
3
by: user | last post by:
Hi all, At the outset, I regret having to post this slightly OT post here. However, I strongly feel that people in this group would be the best to advise me on my predicament. I am working as...
7
by: Robert Seacord | last post by:
The CERT/CC has just deployed a new web site dedicated to developing secure coding standards for the C programming language, C++, and eventually other programming language. We have already...
30
by: Jakle | last post by:
I have been googling, but can seem to find out about C GUI libraries. My main platform is Windows, but it would be nice to find a cross platform library. I've been programming with php, which...
47
by: Thierry Chappuis | last post by:
Hi, I'm interested in techniques used to program in an object-oriented way using the C ANSI language. I'm studying the GObject library and Laurent Deniau's OOPC framework published on his web...
111
by: Enteng | last post by:
Hi I'm thinking about learning C as my first programming language. Would you recommend it? Also how do you suggest that I learn it?What books/tutorials should I read for someone like me? Thanks...
0
by: Drake Tucker | last post by:
Introduction: What is Programming language: Computers are Programmed by means of Programming languages. In the pair of words “Programming” is the commanding tool used to communicate with the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.