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的更多相关文章

  1. PowerDesigner生成的ORACLE 建表脚本中去掉对象的双引号,设置大、小写

    原文:PowerDesigner生成的ORACLE 建表脚本中去掉对象的双引号,设置大.小写 若要将 CDM 中将 Entity的标识符都设为指定的大小写,则可以这么设定: 打开cdm的情况下,进入T ...

  2. 5.oracle建表的时候同时创建主键,外键,注释,约束,索引

    5.oracle建表的时候同时创建主键,外键,注释,约束,索引 1 --主键 )); ) ,constraint aba_pr primary key(id,name1)); --外键 )); --复 ...

  3. oracle 建表时显示ORA-00984: 列在此处不允许

      oracle 建表时显示ORA-00984: 列在此处不允许 CreationTime--2018年7月19日16点10分 Author:Marydon 1.情景展示 使用plsql建表时,报错 ...

  4. oracle 建表时显示ORA-00904无效的标识符

      oracle 建表时显示ORA-00904无效的标识符 CreationTime--2018年7月19日16点03分 Author:Marydon 1.情景展示 使用plsql建表时,报错 字段展 ...

  5. oracle 建表 主键自增序列/////

    oracle 建表 主键自增序列 (2011-10-12 11:59:22) 转载▼ 标签: 杂谈 分类: oracle SQL> create table sms_activity(  2   ...

  6. Oracle建表提示SQL 错误: ORA-00904: : 标识符无效

    Oracle建表提示: 错误报告:SQL 错误: ORA-00904: : 标识符无效00904. 00000 -  "%s: invalid identifier"*Cause: ...

  7. Oracle建表

    1.oracle数据库中的多种数据结构: 1.表结构            存储数据 2.视图 一张表或多张表中数据的字节 3.sequence 主要用来生成主键值 4.index 提高检索性能 我们 ...

  8. oracle建表并设置ID为自动增长

    CREATE TABLESPACE shopping DATAFILE 'D:\oracle\mypc\oradata\orcl\shopping.dbf' SIZE 20M AUTOEXTEND O ...

  9. SQL SERVER 生成ORACLE建表脚本

    /****** Object: StoredProcedure [dbo].[GET_TableScript_ORACLE] Script Date: 06/15/2012 13:07:16 **** ...

  10. Oracle 建表常用数据类型的详解

    创建表时,必须为表的各个列指定数据类型.如果实际的数据与该列的数据类型不相匹配,则数据库会拒绝保存.如为学生指定出生日期为“1980-13-31”. 在Oracle中,常见的数据类型有: 字符串:字符 ...

随机推荐

  1. iOS中使用UIWebView与JS进行交互

    iOS中使用UIWebView与JS进行交互 前一段忙着面试和复习,这两天终于考完试了,下学期的实习也有了着落,把最近学的东西更新一下,首先是使用UIWebView与JS进行交互 在webView中我 ...

  2. FingerChaser(3) 解题报告目录

    所有代码都不超过40行... A:http://www.cppblog.com/willing/archive/2010/05/04/114304.html B:http://www.cnblogs. ...

  3. 【FLYabroad 】微软内部代码检查工具 (Microsoft Source Analysis for C#)[转]

    SourceAnalysis (StyleCop)的终极目标是让所有人都能写出优雅和一致的代码,因此这些代码具有很高的可读性. 早就听说了微软内部的静态代码检查和代码强制格式美化工具 StyleCop ...

  4. 10 款强大的JavaScript图表图形插件推荐

    转自:http://www.iteye.com/news/24535 网上有很多用于绘制图表图形的免费JavaScript插件和图表库,这类插件大量出现的原因,一是人们不再依赖于Flash,二是浏览器 ...

  5. ext.apply和ext.applyIf

    apply的用法: Ext中apply及applyIf方法的应用 apply及applyIf方法都是用于实现把一个对象中的属性应用于另外一个对象中,相当于属性拷贝. 不同的是apply将会覆盖目标对象 ...

  6. grails&groovy的IllegalArgument异常

    我在开发的过程中遇到了这样一个异常,总是提示IllegalArgument异常,代码大致如下: if(haomgl.save(flush:true)){ //更新库存:状态为2的位置存煤 def cu ...

  7. Python的多线程实现

    概述 Python虚拟机使用GIL(Global Interpreter Lock,全局解释器锁)来实现互斥线程对共享资源的访问,暂时无法利用多处理器的优势. Python中,thread和threa ...

  8. Request.QueryString 不能像使用方法那样使用不可调用

    想要获取URL栏中的字符串,于是敲下代码如下: string other = HttpContext.Current.Request.ServerVariables("QUERY_STRIN ...

  9. [转] .NET 3.5中MSChart组件的ImageLocation属性含义

    在.NET程序/网站中如果要生成统计图表/图形,以前可以采用OWC(Office Web Components),如OfficeXP组件OWC10.Office2003组件OWC11.OWC采用COM ...

  10. [Struts2学习笔记] -- 输入校验

    Struts2可以对客户端的输入进行校验,通过重写ActionSupport的validate方法来实现,具体如下: 首先通过用struts标签库创建一个form表单,表单中控件的name与actio ...