在oracle的sql表中怎样增加数据
CREATETABLEmember(memberNochar(3)primarykey,FamilyNamevarchar(15)notnull,GivenNamevar...
CREATE TABLE member
(memberNo char(3) primary key,
FamilyName varchar(15) not null,
GivenName varchar(15),
street varchar(30),
suburb varchar(20),
postcode char(4),
phone varchar(15),
dateOfBirth date,
dateJoined date,
gender char(1),
feesPaid number(5,2),
registrationNumber number,
CONSTRAINT registrationNumber_un UNIQUE (registrationNumber));
INSERT INTO member VALUES(123,'Jenkins','Harry','32 High St','Launceston','7250','(03)6312 3456',
'17-MAR-1968','18-JUN-1995','M', 75, 2351);
。。。加入一些数据
然后需要建立一个下面的表格。。。代码应该怎样写呃。。。。。。。。。。。。。。。。。。。
Contact List
MEMBER Home Phone
----------------------------------------------------- ------------
Atrick, G : 27 Sunset Court, Launceston 03 6334 2418
Atrick, M : 27 Sunset Court, Launceston 03 6334 2418
Clippers, N : 2 Side Street, Launceston 03 6332 4248
Greene, L : 2 Hawkins St, Launceston 03 6334 6767
Hawkins, S : 2 Jenkins St, Launceston 03 6334 1256
Hawkins, S : 2 Jenkins St, Launceston 03 6334 1256
Jenkins, H : 32 High St, Launceston 03 6312 3456
然后在Home Phone旁边再update一项Mobile phone number,应该怎么写?
具体数据是
Name Mobile phone number
Susie Hawkins 0427 123 456
Steven Hawkins 0428 231 312 展开
(memberNo char(3) primary key,
FamilyName varchar(15) not null,
GivenName varchar(15),
street varchar(30),
suburb varchar(20),
postcode char(4),
phone varchar(15),
dateOfBirth date,
dateJoined date,
gender char(1),
feesPaid number(5,2),
registrationNumber number,
CONSTRAINT registrationNumber_un UNIQUE (registrationNumber));
INSERT INTO member VALUES(123,'Jenkins','Harry','32 High St','Launceston','7250','(03)6312 3456',
'17-MAR-1968','18-JUN-1995','M', 75, 2351);
。。。加入一些数据
然后需要建立一个下面的表格。。。代码应该怎样写呃。。。。。。。。。。。。。。。。。。。
Contact List
MEMBER Home Phone
----------------------------------------------------- ------------
Atrick, G : 27 Sunset Court, Launceston 03 6334 2418
Atrick, M : 27 Sunset Court, Launceston 03 6334 2418
Clippers, N : 2 Side Street, Launceston 03 6332 4248
Greene, L : 2 Hawkins St, Launceston 03 6334 6767
Hawkins, S : 2 Jenkins St, Launceston 03 6334 1256
Hawkins, S : 2 Jenkins St, Launceston 03 6334 1256
Jenkins, H : 32 High St, Launceston 03 6312 3456
然后在Home Phone旁边再update一项Mobile phone number,应该怎么写?
具体数据是
Name Mobile phone number
Susie Hawkins 0427 123 456
Steven Hawkins 0428 231 312 展开
展开全部
建立表格:
create table contact_list as
select givenname||', '||substr(familyname,1,1)||' : '||street||', '||suburb||' ' MEMBER, phone "Home Phone" from member;
添加Mobile phone number:
首先要建立新的column:
alter table contact_list
add "Mobile phone number" varchar2(15);
(建议所有varchar改为varchar2,两者目前是等价,但今后的oracle版本varchar可能改为其他用途)
然后修改数据:
update contact_list
set "Mobile phone number"='0427 123 456'
where name='Susie Hawkins';
update contact_list
set "Mobile phone number"='0428 231 312'
where name='Steven Hawkins';
(不知道这里的name column哪里来的?在第一问的表格中没有)
create table contact_list as
select givenname||', '||substr(familyname,1,1)||' : '||street||', '||suburb||' ' MEMBER, phone "Home Phone" from member;
添加Mobile phone number:
首先要建立新的column:
alter table contact_list
add "Mobile phone number" varchar2(15);
(建议所有varchar改为varchar2,两者目前是等价,但今后的oracle版本varchar可能改为其他用途)
然后修改数据:
update contact_list
set "Mobile phone number"='0427 123 456'
where name='Susie Hawkins';
update contact_list
set "Mobile phone number"='0428 231 312'
where name='Steven Hawkins';
(不知道这里的name column哪里来的?在第一问的表格中没有)
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
insert member(memberNO,FamilyName...)value('数值','数值'......)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
可以使用insert into
或者update
或者update
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询