当前位置:数据库 > SQLServer >>

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

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.zzzyk.com/database/110/04d96851b90175bfa77b79f7775ef743.htm

补充:数据库,Mssql
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,