且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在多个表中插入多个值

更新时间:2022-04-02 08:40:09





i已插入两个表格一个查询。



我尝试了什么:



i试过了


插入table_1(unique_no,姓名,年龄,地址)值('127890','rahul','27','newyork ......' );



插入table_2(s_no,unique_no,phone_no,car_details,salary)值('45','127890','1234567890','宝马', '64,000


i have insert both tables at one query.

What I have tried:

i have tried

insert into table_1(unique_no, name ,age, address) value('127890','rahul','27', 'newyork......');

insert into table_2(s_no,unique_no,phone_no,car_details,salary) value('45','127890', '1234567890','BMW','64,000


');



需要时间,如果我有100个表来插入列...

i想要写一个查询..是否有可能。
');

it take time, if i have 100 tables to insert columns...
i want to write one query.. is it possible.


据推测,你是从某种形式的演示语言中做到这一点,我们不知道是什么,或者如何!请记住,我们无法看到您的屏幕,访问您的硬盘或阅读您的想法 - 我们只能准确地获取您要输入的内容。并且有数百种不同的方法可以做到这一点。



首先看看你现在是怎么做的:假设这是一种.NET语言,使用秒表课程 [ ^ ]时间你现在拥有的东西:

Presumably, you are doing this from a presentation language of some form, we have no idea what, or how! Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with. And there are hundreds of different ways you could be doing this.

So start by looking at how you are doing it at the moment: assuming this is a .NET language, use the Stopwatch class[^] to time what you have at present:
Stopwatch sw = new Stopwatch();
sw.Start();
... code to do the timed operation ..
sw.Stop();
Console.WriteLIne(sw.Ticks);

这为您提供了一个可以使用的基线,并且可以使用多个秒表来找出您编码速度慢的地方 - 这样您就可以集中精力加快速度。

请注意,您可能需要多次(数千次)进行操作以获得有意义的数字,除非您的代码太慢,日食可以计时!



除非你有多慢的有效数据以及速度慢的地方,否则尝试加快速度是毫无意义的!

This gives you a baseline to work from, and multiple stopwatches can be used to find out where you code is slow - so you can focus your efforts on speeding that up.
Do note that you may want to do the operations multiple times (several thousand) to get meaningful numbers unless you code is so slow a sundial could time it!

Until you have meaningful stats on how slow it is and where it is slow, it's pointless trying to speed anything up!