I want to write a unique query to store the same values in different tables: I am with AA and BB tables . Specialty number, address, phone, city There are no two cities in it and the rest are different. Some features in both tables are unique and some are different and I want to update 2 tables using a query in the SQL query.
You just have to upgrade a bit more than just a simple query to complete this. My advice would be to do your design by entering the number and city in a separate table normalize and then just link it from this table to the other two tables. Normally you should not duplicate information in more than one table. There are exceptions though. Although you have not asked for advice, so there may be reasons to do so in the manner you ask. If this is still the path you want your options to go down then how can you use SQL on many SQL platforms you can complete it with the stored procedure. On some you can use a view, a trigger, and a stored procedure. I give you a quick summary of each option. - Stored Process Write one or more stored procedures (perhaps inserting, updating, deleting each one) These processes query your values as values, then query each table One runs after the other. - View stored procedures + Triggers (You can do it on MS SQL Server but I'm not sure about others.) Here you create a single scene that merges into two tables (in your normal areas). It gives you a view that basically combines two tables together. Now because this view is based on two tables, it becomes a non-updateable view even though you can see to insert, update, and delete stored processes. Here you do the same thing as the first method, you actually create several procs to update the data in two tables below the view. This process is slightly different because it needs to be designed to work as a trigger. Then you insert, update or delete triggers to see these processes. When all is said and done, then insert, update, or delete data directly into the view and see the changes in the underlying tables. If it seems that is really complex, it is because it is. If you have another option like to solve the problem, you should try first to normalize your data structure. If you do not really have any choice and triggers are available, then the second option really works well.
Comments
Post a Comment