如何在多个表中插入多个值 [英] How to insert multiple value in multiple tables

查看:112
本文介绍了如何在多个表中插入多个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在多个查询中的多个故事中插入多个值(列)。并花时间。插入







例如

表1

unique_no姓名年龄地址

127890 rahul 27 newyork ......



table 2

s_no unique_no phone_no car_details薪水

45 127890 1234567890宝马64,000 $



i在一个查询中插入两个表格。



我尝试了什么:



i已经尝试了



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



插入table_2(s_no,unique_no,phone_no,car_details,salary)值('45','127890','1234567890','BMW','64,000 $');



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

i想写一个查询..是否可能。

Iam able to insert multiple values (columns) in multiple tales in multiple query. and taking time. to insert



for example
table 1
unique_no name age address
127890 rahul 27 newyork......

table 2
s_no unique_no phone_no car_details salary
45 127890 1234567890 BMW 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$');

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

推荐答案





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



我尝试了什么:



i试过了< br $>


插入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!


这篇关于如何在多个表中插入多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆