一聚教程网:一个值得你收藏的教程网站

热门教程

mssql server创建表与保存数据语句

时间:2022-06-29 08:30:41 编辑:袖梨 来源:一聚教程网

create table "tablename"

  ("column1" "data type",

  "column2" "data type",

  "column3" "data type");

  如果你想使用可选的约束,创建表格的格式为:

  create table "tablename"

  ("column1" "data type" [constraint],

  "column2" "data type" [constraint],

  "column3" "data type" [constraint]);

  [ ] = optional


create table T_Employee(FNumber VARCHAR(20),FName VARCHAR(20),FAge int,FSalary NUMERIC(10,2) ,PRIMARY KEY(FNumber));
insert into T_Employee(FNumber,FName,FAge,FSalary) values('DEV001','Tom',25,8300);
insert into T_Employee(FNumber,FName,FAge,FSalary) values('DEV002','Jerry',28,2300.80);
insert into T_Employee(FNumber,FName,FAge,FSalary) values('SALES001','John',23,5000);
insert into T_Employee(FNumber,FName,FAge,FSalary) values('SALES002','Kerry',28,6200);
insert into T_Employee(FNumber,FName,FAge,FSalary) values('SALES003','Stone',22,1200);
insert into T_Employee(FNumber,FName,FAge,FSalary) values('HR001','Jane',23,2200.88);
insert into T_Employee(FNumber,FName,FAge,FSalary) values('HR002','Tina',25,5200.36);
insert into T_Employee(FNumber,FName,FAge,FSalary) values('IT001','Smith',28,3900);
insert into T_Employee(FNumber,FAge,FSalary) values('IT002',27,2800);


http://www.111com.net/database/110/04d96851b90175bfa77b79f7775ef743.htm

热门栏目