ORACLE多表多插
在Oracle中,一次性在多个表格中插入多个语句,具体代码如下:(红色为关键字)
In Oracle,you can insert several sentences at one time,now the specific code is below:
**********代码开始start**********
insert all
into +表名1+(id,name,password,image,age)values (1,'xiaohuang','123456','dog','27')
into +表名2+(id,uid,money,phone,email) values (1,1,'100','18888888888','1491527416@qq.com')
select * from dual;
**********代码结束end**********
注意:
pay attention:
1、这么分成4行写是为了书写美观,编译维护;也可以写成一行,但是辨识度不好,不推荐;
For buitiful and convenient ,I take this code sentence apart in 4 rows,you can also write in one row,but it may cause misunderstanding;
2、括号内蓝色字体是两个表各自的属性(字段名,column)
The blue charachers in the blankets are the column of their own table;
3、dual是万能表,处理特殊操作,是oracle中最小的表;
Word dual can use flexible,especially for particular usage,she is the smallest table in Oracle;
两个表格,分别是:
two tables are show below:
user(用户表) | ||||||
字段名 |
类型 |
长度 |
默认值 |
是否为空 |
是否自增 |
主键 |
id |
int |
10 |
|
否 |
是 |
是 |
name(用户名) |
varchar |
255 |
|
否 |
|
外 |
password(密码) |
varchar |
255 |
|
否 |
|
|
image(头像) |
varchar |
255 |
|
|
|
|
age(年龄) |
varchar |
4 |
|
|
|
|
|
|
|
|
|
|
|
userdetail(用户详细信息表) | ||||||
id(id) |
int |
10 |
|
否 |
是 |
是 |
uid(用户id) |
int |
10 |
|
否 |
|
外 |
money(余额) |
varchar |
255 |
0 |
|
|
|
phone(联系方式) |
varchar |
255 |
|
|
|
|
email(邮箱) |
varchar |
255 |
|
|
|
|