小工具知识网

当前位置: 首页 > 行业知识 > sql server创建数据表的完整语法

行业知识

sql server创建数据表的完整语法

2026-11-12 22:01:09 来源:互联网转载

1.创建数据库

语法:CREATE DATABASE 

复制

CREATE DATABASE dbname -- 创建名为 dbname 的数据库

复制

2.表的创建

 语法:USE suntest  create table 仓库  (  仓库编号 int ,   仓库号 varchar(50) ,   城市 varchar(50) ,   面积 int  )  create table 仓库1  (  仓库编号 int not null ,   仓库号 varchar(50) not null,   城市 varchar(50) not null, --不能为空not null--  面积 int  )  create table 仓库2  (  仓库编号 int primary key , --主键的关键字primary key--  仓库号 varchar(50) unique, --唯一索引关键字unique--  城市 varchar(50) not null, --不能为空not null--  面积 int  )  create table 仓库3  (  仓库编号 int primary key , --主键的关键字primary key--  仓库号 varchar(50) unique, --唯一索引关键字unique--  城市 varchar(50) default '青岛', --不能为空not null--  面积 int check (面积>=300 and 面积=800 and 基本工资=800 and 基本工资=300 and 面积=0 and sAge=600 and 面积=800 and 基本工资=300 and 面积=300 and 面积

上一篇:Python 全栈系列232 再次搭建RabbitMQ

下一篇:星露谷物语iOS版下载指南