ylbtech-DatabaseDesgin:ylbtech-cnblogs(博客园)-数据库设计-2,Admin(用户后台)

DatabaseName:同学录

Model:

Type:

Url:

1.A,数据库关系图(Database Diagram) 返回顶部
1.B,数据库设计脚本(Database Design Script)返回顶部
-- =============================================
-- Create database template
-- =============================================
USE master
GO -- Drop the database if it already exists
IF EXISTS (
SELECT name
FROM sys.databases
WHERE name = N'classbook'
)
DROP DATABASE classbook
GO CREATE DATABASE classbook
GO
use classbook
go
-- =============================================
-- Create Table 班级表
-- =============================================
create table class
(
classid int identity primary key, --编号
name varchar(100) not null --名称
)
-- =============================================
-- Create Table 留言表
-- =============================================
create table newsboard
(
newsboardid int identity primary key, --编号
title varchar(2000) not null, --名称
username varchar(20), --留言人
headimage varchar(100), --头像
pubdate datetime default(getdate()) --留言时间
)
-- =============================================
-- Create Table 用户表
-- =============================================
create table users
(
usersid int identity(720001,1) primary key, --编号
pwd varchar(20) not null, --密码
[power] varchar(20) check([power]='admin' or [power]='guest') default('guest'), --级别
pubdate datetime default(getdate()) --申请日期
)
-- =============================================
-- Create Table 学生表
-- =============================================
create table student
(
studentid int identity primary key, --编号
name varchar(20), --姓名
sex varchar(2) check(sex='男'or sex='女') default('男'), --性别
age int, --年龄
qq varchar(100), --QQ号
[e-mail] varchar(100), --邮箱
tel varchar(100), --固话
address varchar(1000), --所在地
phone varchar(100), --电话
headimage varchar(1000), --头像图片
classid int foreign key references class(classid) not null, --班级编号
usersid int foreign key references users(usersid) not null --用户编号
)
-- =============================================
-- Create Table 短信表
-- =============================================
create table messages
(
messageid int identity(720001,1) primary key,--编号
title varchar(1000), --标题
body varchar(2000), --内容
pubdate datetime default(getdate()), --发布日期
inboxid int, --发信人的编号
outboxid int, --收信人的编号
inboxname varchar(20), --发信人姓名
outboxname varchar(20), --收信人姓名
dal int default(0) --是否已读,0:没读,1:已读
)
--插入一些测试信息
insert users(pwd,[power]) values('','admin')
insert class(name) values('T03')
select @@identity
select * from class
select * from users
select * from newsboard
select * from student
select * from messages insert student(name,sex,age,qq,[e-mail],tel,address,phone,classid,usersid)
values('','男','','','','','','',1,720001)
insert student(name,sex,age,qq,e-mail,tel,address,phone,classid,usesrid)
values() select studentid,name,sex,age,qq,[e-mail],tel,address,phone,headimage,classid,usersid from student
select studentid from student where usersid=720002
1.C,功能实现代码(Function Implementation Code)返回顶部
作者:ylbtech
出处:http://ylbtech.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

DBS:同学录的更多相关文章

  1. mongodb use db show dbs

    mongodb 常用命令: 在dbs间切换用 use xxxdb 之后再操作就是只针对 xxxdb了: show dbs显示全部数据库 show collections 显示全部集合 mongodb数 ...

  2. [福大软工] Z班 团队作业——随堂小测(同学录) 作业成绩

    团队作业--随堂小测(同学录) 作业链接 http://www.cnblogs.com/easteast/p/7763645.html 作业情况 本次作业从原先预计的3小时,有些组打了鸡血连续肝了4. ...

  3. Hello world!(内含自己编写的C语言二叉树同学录)

      修改:刷了一段时间的题,水平渐涨,发现同学录真的要做成市面可行的应用的话,应该按学号建立二叉平衡树,红黑树是一个可行的选择. 在同学的推荐下,来到博客园来找志同道合的人交流代码.3个月后参加蓝桥杯 ...

  4. DB DBS 和DBMS区别

    DB:是指datebase(数据库)  DBS:是指datebase systerm (数据库系统)  DBMS:是指datebase mangement systerm(数据库管理系统)区别:数据库 ...

  5. 数据库系统概述(Data Model、DBMS、DBS、RDBS、Structured Query Language)

    数据Data 描述事物的符号记录成为数据. 数据是数据库中存储的基本对象.   除了基本的数字之外.像图书的名称.价格.作者都可以称为数据. 将多种数据记录列成一张表.通过数据表管理数据. 每一行的数 ...

  6. count failed: not master{ "note" : "from execCommand", "ok" : 0, "errmsg" : "not master" } at src/mongo/shell/query.js:191在SECONDARY节点无法show dbs

    count failed: not master{ "note" : "from execCommand", "ok" : 0, " ...

  7. 误删除$ORACLE_HOME/dbs下的参数文件、密码文件,如何快速重建

    [oracle@11g dbs]$ pwd/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs[oracle@11g dbs]$ lltotal 24 ...

  8. Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: REFERENCES command denied to user 'nali'@'localhost' for table 'dbs'

    按照教程 Install hive on Mac with Homebrew,在 mac 上安装 Hive 时, 最后执行 hive 命令后,出现错误: Exception in thread &qu ...

  9. 数据库备份 DBS(Database Backup),知识点

    资料 网址 什么是DBS https://help.aliyun.com/document_detail/59133.html?spm=5176.13685554.103.6.3fa463f9CDwW ...

随机推荐

  1. zoj 1002 Fire Net (二分匹配)

    Fire Net Time Limit: 2 Seconds      Memory Limit: 65536 KB Suppose that we have a square city with s ...

  2. P3141 [USACO16FEB]围栏Fenced In_Platinum

    题目描述 Farmer John has realized that many of his cows are strangely agoraphobic (being fearful of larg ...

  3. DateBase -- Rising Temperature

    Question: Given a Weather table, write a SQL query to find all dates' Ids with higher temperature co ...

  4. MAC使用IDA PRO远程调试LINUX程序

    1 背景 在学习Linux系统上的一些漏洞知识的时候,往往需要进行“实地测试”,但是在Linux系统上进行调试并不太方便,因为LINUX自带的GDB调试工具真的不太人性化,即使有GDBTUI之类的“伪 ...

  5. HDU1285 裸的拓扑排序

    拓扑排序: 拓扑排序是应用于有向无回路图(DAG)上的一种排序方式,对一个有向无回路进行拓扑排序后,所有的顶点形成一个序列,对所有边(u,v),满足u在v的前面.该序列说明了顶点表示的事件或 状态发生 ...

  6. snmp 默认团体名检测利用

    [root@izj6c2n1nth4tg8emd8h58z tmp]# lsb_release LSB Version:    :core-4.1-amd64:core-4.1-noarch[root ...

  7. 第18章 Active控件

    转自: https://blog.csdn.net/u014162133/article/details/46573873 容器和服务器程序 容器应用程序时可以嵌入或链接对象的应用程序.Word就是容 ...

  8. (八)ubuntu安装软件提示:Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)

    question: ubuntu@ubuntu:/usr/src/Linux-headers-3.5.0-23-generic$ sudo apt-get install cheese [sudo] ...

  9. 厦门海沧区磁盘只有1TB的解决方案

    厦门海沧区磁盘只有1TB的解决方案 1.为WINDOWS 2008 r2 服务器增加5个1T的硬盘 2.打开命令提示符,并键入 diskpart. 3.在“DISKPART”提示符下,键入 list ...

  10. win2008通过计划任务定时执行bat文件

    前段时间在Windows Server 2008安装了一套基于MySQL数据库的软件,处于数据安全的考虑,希望每天能够自动进行数据库备份.我在别人脚本的基础上自己写了一个数据库备份的bat脚本,双击该 ...