--在查询分析器中执行:--创建表 create table tablename (id int,name varchar(20),age int)
--比如姓名、年龄两列我要写入具体值怎么办?insert into tablename(id,name,age) select 1,'张三',29
http://passport.csdn.net/account/forgotpassword
是insert into 啊我这真是急糊涂了连这个都忘了。呜呜~~~~(>_<)~~~~ 还是没学扎实!!!!!!!!!!!谢谢了
两种方法都可以 select 用法一般用于多条记录 或者从其他表获取记录时候用 如 insert tb(col)select col from ta
insert table(col1,col2......) select col1,col2...... union all select col1,col2...... union all ...... select col1,col2...
--例如: create table student( id int, name varchar(20), age int ) insert student (id,name) select 1,'tracy' union all select 2,'lucy' union all select 3,'lily' union all select 4,'tom'select *from student/* id name age 1 tracy NULL 2 lucy NULL 3 lily NULL 4 tom NULL */
create table tablename (id int,name varchar(20),age int)
http://passport.csdn.net/account/forgotpassword
select 用法一般用于多条记录
或者从其他表获取记录时候用
如
insert tb(col)select col from ta
select col1,col2......
union all
select col1,col2......
union all
......
select col1,col2...
create table student(
id int,
name varchar(20),
age int
)
insert student (id,name)
select 1,'tracy'
union all
select 2,'lucy'
union all
select 3,'lily'
union all
select 4,'tom'select *from student/*
id name age
1 tracy NULL
2 lucy NULL
3 lily NULL
4 tom NULL
*/