SQL Server 相关create操作语句
创建数据库:
create database jylt
on (
name=jylt,
filename='e:\db\jylt.mdf',
size=4,
filegrowth=100%,
maxsize=1024
)
log on
(
name=jylt_log,
filename='e:\db\jylt_log.ldf',
size=4,
filegrowth=100%
)
go
1,增:insert into t_user values('wangpeng','19');s
2,删:delete from t_user where t_user.age<30
3,改:update t_user name='xiaohong' where name='dahong'
4,查:select name as '名字' age as '年龄' from t_user where name='xiaohong'
check约束: age between 18 and 70 and gongzi 1000 and 3000
use master
go
create database jylt
on (
name=jylt,
filename='e:\db\jylt.mdf',
size=4,
filegrowth=100%,
maxsize=1024)
log on(
name=jylt_log,
filename='e:\db\jylt_log.ldf',
size=4,
filegrowth=100%)
go
use jylt
go
create table t_user
(
uid int primary key identity(1,1) not null,
ulname varchar(50) not null,
ulpwd varchar(50) not null,
unichen varchar(50) null,
uname varchar(50) null,
uaddress varchar(200) null,
usex int ,
utelephone varchar(50) null,
uhomepage varchar(200) null,
uimageurl varchar(200) null,
usignature varchar(200) null
)
go
create table t_reply
(
rid int not null primary key,
uid int foreign key references t_user(uid) ,
rtitle varchar(50),
rcontent varchar(max) not null,
rdatetime datetime default getdate()
)
go
create table t_board
(
bid int primary key not null,
bname varchar(50) not null,
bimgurl varchar(200) null,
binfo varchar(200) null
)
go
create table t_topic
(
tid int primary key not null,
ttitle varchar(50) not null,
tcontent varchar(max) not null,
tdatetime datetime default getdate(),
uid int foreign key references t_user(uid),
tview int default 0,
bid int references t_board(bid)
)
go
转载于:https://www.cnblogs.com/netact/archive/2010/07/06/1771874.html
SQL Server 相关create操作语句相关推荐
- Sql Server 和 Access 操作数据库结构Sql语句
下面是Sql Server 和 Access 操作数据库结构的常用Sql,希望对你有所帮助. 新建表: create table [表名] ( [自动编号字段] int IDENTITY (1,1) ...
- sql server学习笔记——批处理语句、存储过程
目录 批处理语句 1.批处理语句简介 示例一: 示例二: 存储过程 一.什么是存储过程 1.存储过程的简介 2.存储过程包含的内容 3.存储过程的优点 4.存储过程的分类 系统存储过程: 用户定义存储 ...
- 数据库应用程序开发基础篇—— .NET中SQL Server数据库的操作C#篇之一
数据库应用程序开发基础篇-- .NET中SQL Server数据库的操作C#篇之一 写在前面:前面介绍了数据库系统的基本概念,SQl语句基本使用方法,接下来通过学习具体语言和具体数据库结合的应用开发来 ...
- SQL Server FOR XML PATH 语句的应用---列转行
经常在论坛看到高手使用了 for xml path,由于是搜索一下,记录了详细的使用方法. 在SQL Server中利用 FOR XML PATH 语句能够把查询的数据生成XML数据,下面是它的一些应 ...
- SQL Server远程连接操作
SQL Server远程连接操作 -- 开启远程选项 exec sp_configure 'show advanced options',1 reconfigure exec sp_configure ...
- Oracle+Sql Server相关查询语句
上周处理过 Oracle.Sql Server 数据库相关数据,发现其实它们的 SQL 查询语句有些是不太一样的,比如行列转置和将查询结果插入新表.本人还是比较愿意写 SQL 语句的,互联网的技术日新 ...
- SQL Server 2000优化SELECT语句方法
本文是SQL Server SQL语句优化系列文章的第一篇.该系列文章描述了在Micosoft's SQLServer2000关系数据库管理系统中优化SELECT语句的基本技巧,我们讨论的技巧可在Mi ...
- SQL Server相关知识
SQL Server 中科永联高级技术培训中心(www.itisedu.com) SQL Server是微软公司开发的一个关系数据库管理系统,以Transact_SQL作为它的数据库查询和编程语言.T ...
- 在SQL Server中插入IN-T-SQL语句
In this article, we will go deeply through the INSERT INTO statement by showing the different syntax ...
最新文章
- 16进制 hbase phoenix_【建议收藏】HBase表的RowKey设计
- 工信部王卫明:我国5G研发开局良好
- 初级,用powerdesigner生成的sql创建access数据库
- npm教程:使用nrm切换镜像源
- 乐鑫代理-启明云端分享ESP32系列教程之一: 安装虚拟机及Ubuntu
- A01_[NumPy中文网]数组基础(创建数组,多维数组切片,数组属性)、使用数组(基本操作符,数组特殊运算符)、索引(花式索引,布尔索引,缺省索引)
- 工控设备 如何将数据发送到串口_嵌入式无风扇工控机在水质监测系统中的应用...
- 计算机二进制基础列式,计算机基础;十进制数100对应的二进制数、八进制数和十六进制数分别是...
- 自学C语言能到达怎样的高度?
- 一个html中同时引入js和ts,《使用require在ts里引入js》
- Activity之间传递参数
- Linux:sudo命令实例讲解
- 此计算机中未配置默认浏览器,飞火浏览器设置默认浏览器失败了怎么办-飞火浏览器设置默认浏览器的方法 - 河东软件园...
- 【运输量预测】基于matlab多种算法公路运输量预测【含Matlab源码 041期】
- 关于震旦AD248B双面打印
- MySQL经典50道练习题及全网最详细解析
- Java-学习-喜欢-品牌:互联网公司成为动物园,拟人化品牌形象真的那么有意思?...
- BladeX框架源码分析--00、包结构
- android 百度地图自定义定位小箭头图标,并随着手机方向转动
- 微信关注公众号跳转关注页面
热门文章
- iOS原生CIFilter创建二维码
- SQL SERVER-约束
- Vim文本编辑器 指令簿(二)
- [Java] webservice soap,wsdl 例子
- windows cmd后ipconfig后提示不是内部命令或外部命令
- IIS不能发布asp.net 应用程序
- mysql往前一天同一时间_Mysql时间轴数据 获取同一天数据的前三条
- Android studio 运行即打包keystore之build.gradle设置
- npm i依赖版本兼容问题处理
- Axure SVN共享 Commit Failed (details Follow) 问题解决