阳光餐厅--oracle---建表---danrong
select * from manager;
select * from dish;
select * from board;
select * from employee;
select * from orders;
select * from order_detail; -- 菜品表 create table dish
(
dishID number(10) primary key,
dishName varchar2(10) not null unique,
category varchar2(10) not null,
price number(10) not null,
picture varchar2(40) not null,
status number(10) not null
) create sequence dish_se start with 1 increment by 1
maxvalue 5000; insert into dish (dishID,dishName,category,price,picture,status)
values(dish_se.nextval,'XX','XX','XX','XX','XX'); select * from dish; --管理员表
create table manager
(
mid number(10) primary key,
mname varchar2(10) not null unique,
password varchar2(10) not null
)
create sequence manager_se start with 1 increment by 1
maxvalue 5000; insert into manager (mid,mname,password)
values(manager_se.nextval,'1','1'); select * from manager; --餐桌表
create table board
(
boardid number(10) primary key,
capacity number(10) not null
) create sequence board_se start with 1 increment by 1
maxvalue 5000; insert into board (boardid,capacity)
values(board_se.nextval,'4'); select * from board; --职员表 create table employee
(
eID number(10) primary key,
ename varchar2(10) not null,
sex varchar2(10) not null,
position varchar2(10) not null,
epassword varchar2(10) not null
) create sequence emp_se start with 1 increment by 1
maxvalue 5000; insert into employee(eID,ename,sex,position,epassword)
values (emp_se.nextval,'1','男','服务员','1'); select * from employee; --创建订单表
create table orders
(
orderID number(10) primary key,
boardID number(10) not null, --外键
pnumber number(10) not null,
client varchar2(10), --允许为空
mobile_number varchar2(20),--允许为空
order_time varchar2(20) not null,
arrive_time varchar2(20) not null,
cash number(10),
change number(10),
status number(10) not null
) --外键约束
alter table orders add
constraint fk_order_boardID foreign key (boardID) references board (boardID); create sequence order_se start with 1 increment by 1
maxvalue 5000; insert into orders (orderID,boardID,pnumber,client,mobile_number,order_time,arrive_time,cash,change,status)
values(order_se.nextval,'1','4','yz',null,sysdate,'2017-1-9',100,1,1); select * from orders; -- 订单详情表 create table order_detail
(
odID number(10) primary key,
orderID number(10) not null, -- 外键
eID number(10) not null,-- 外键
dishID number(10) not null,-- 外键
taste number(10) not null,
price number(10) not null,
count number(10) not null,
status number(10) not null
) --外键约束
alter table order_detail add
constraint fk_ordt_orderID foreign key (orderID) references orders (orderID);
alter table order_detail add
constraint fk_ordt_eID foreign key (eID) references employee (eID);
alter table order_detail add
constraint fk_ordt_dishID foreign key (dishID) references dish (dishID); create sequence ordt_se start with 1 increment by 1
maxvalue 5000; insert into order_detail (odID,orderID,eID,dishID,taste,price,count,status)
values(ordt_se.nextval,1,1,3,1,10,1,1);
阳光餐厅--oracle---建表---danrong的更多相关文章
- PowerDesigner生成的ORACLE 建表脚本中去掉对象的双引号,设置大、小写
原文:PowerDesigner生成的ORACLE 建表脚本中去掉对象的双引号,设置大.小写 若要将 CDM 中将 Entity的标识符都设为指定的大小写,则可以这么设定: 打开cdm的情况下,进入T ...
- 5.oracle建表的时候同时创建主键,外键,注释,约束,索引
5.oracle建表的时候同时创建主键,外键,注释,约束,索引 1 --主键 )); ) ,constraint aba_pr primary key(id,name1)); --外键 )); --复 ...
- oracle 建表时显示ORA-00984: 列在此处不允许
oracle 建表时显示ORA-00984: 列在此处不允许 CreationTime--2018年7月19日16点10分 Author:Marydon 1.情景展示 使用plsql建表时,报错 ...
- oracle 建表时显示ORA-00904无效的标识符
oracle 建表时显示ORA-00904无效的标识符 CreationTime--2018年7月19日16点03分 Author:Marydon 1.情景展示 使用plsql建表时,报错 字段展 ...
- oracle 建表 主键自增序列/////
oracle 建表 主键自增序列 (2011-10-12 11:59:22) 转载▼ 标签: 杂谈 分类: oracle SQL> create table sms_activity( 2 ...
- Oracle建表提示SQL 错误: ORA-00904: : 标识符无效
Oracle建表提示: 错误报告:SQL 错误: ORA-00904: : 标识符无效00904. 00000 - "%s: invalid identifier"*Cause: ...
- Oracle建表
1.oracle数据库中的多种数据结构: 1.表结构 存储数据 2.视图 一张表或多张表中数据的字节 3.sequence 主要用来生成主键值 4.index 提高检索性能 我们 ...
- oracle建表并设置ID为自动增长
CREATE TABLESPACE shopping DATAFILE 'D:\oracle\mypc\oradata\orcl\shopping.dbf' SIZE 20M AUTOEXTEND O ...
- SQL SERVER 生成ORACLE建表脚本
/****** Object: StoredProcedure [dbo].[GET_TableScript_ORACLE] Script Date: 06/15/2012 13:07:16 **** ...
- Oracle 建表常用数据类型的详解
创建表时,必须为表的各个列指定数据类型.如果实际的数据与该列的数据类型不相匹配,则数据库会拒绝保存.如为学生指定出生日期为“1980-13-31”. 在Oracle中,常见的数据类型有: 字符串:字符 ...
随机推荐
- 【VB】StrConv函数 vbUnicode用法
[VB]StrConv函数 StrConv(string, conversion, LCID) vbUnicode 64 根据系统的缺省码页将字符串转成Unicode. vbFromUnicode 1 ...
- Linq101-Restriction
using System; using System.Linq; namespace Linq101 { class Restriction { /// <summary> /// Thi ...
- (转)PHP中extract()函数的妙用
近日在看一个牛人的代码时,看到一个非常好用的函数:extract(),它的主要作用是将数组展开,键名作为变量名,元素值为变量值,可以说为数组的操作提供了另外一个方便的工具,比方说,可以很方便的提取$_ ...
- 黑马程序员-ReadInt
判断输入的字符串是否为数字. namespace 读入一个整数 { class Program { static void Main(string[] args) { Console.WriteLin ...
- 【转】自动布局之autoresizingMask使用详解(Storyboard&Code)
原文:http://www.cocoachina.com/ios/20141216/10652.html 自动布局Autolayoutstoryboard 前言:现在已经不像以前那样只有一个尺寸,现在 ...
- 想加入一行代码吗?使用<code>标签
在介绍语言技术的网站中,避免不了在网页中显示一些计算机专业的编程代码,当代码为一行代码时,你就可以使用<code>标签了,如下面例子: <code>var i=i+300;&l ...
- Listbox与dataGridView的获取鼠标点击事件的区别!!!
lisxian.SelectedIndex = index; Listbox获取鼠标的代码!!!! DataGridViewRow currenRow = this.dgvxian3.Rows[ind ...
- Starting and Stopping Oracle Fusion Middleware
指定用户名密码启动管理服务器 You can start and stop Oracle WebLogic Server Administration Servers using the WLST c ...
- 嘟!数字三角形 W WW WWW集合!
哔!数字三角形全体集合! 数字三角形!到! 数字三角形W!到! 数字三角形WW!到! 数字三角形WWW!到! --------------------------------------------- ...
- 12_RHEL7.1普通用户添加sudo权限
1.关于sudo Sudo是linux系统中,非root权限的用户提升自己权限来执行某些特性命令的方式,它使普通用户在不知道超级用户的密码的情况下,也可以暂时的获得root权限. 一 ...