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. 原生js方法document.getElementsByClassName在ie8及其以下的兼容性问题

    document.getElementsByClassName在ie8及其以下浏览器的兼容性问题,在ie8及其以下浏览器中不能使用,针对这个问题,下面给出详细的解决方法,感兴趣的朋友可以参考下     ...

  2. struts2与spring集成时,关于class属性及成员bean自动注入的问题

    http://blog.csdn.net/sun_zhicheng/article/details/24232129

  3. word2vec生成词向量原理

    假设每个词对应一个词向量,假设: 1)两个词的相似度正比于对应词向量的乘积.即:$sim(v_1,v_2)=v_1\cdot v_2$.即点乘原则: 2)多个词$v_1\sim v_n$组成的一个上下 ...

  4. Python Function Note

    Python Function Note #汉诺塔问题Python实现 def my_move(n, a, b, c): if n == 1: print(a + ' --> ' + c) el ...

  5. C# static 干货全解析

    讲解顺序 背景 静态字段 静态函数 静态方法 疑问解答 背景 static来源 在编写类的时候,有时候需要类里面的某个成员具有唯一性,也就是,对所有的对象都保持只有一个的状态.比如创建个人信息,我们都 ...

  6. css水平居中的小小探讨

    水平居中是常用的几种布局方式之一.主要分为行内元素的居中,块元素的居中.块元素的居中还分为固定宽度的居中,不定宽度的居中.行内元素的居中,使用text-align:center就可以实现,已知宽度的块 ...

  7. Qt信号槽连接在有默认形参下的情况思考

    写下这个给自己备忘,比如函数 ) 你在调用端如论是test(3)或者test(),都可以正确调用到这个函数. 但是,如果放到Qt中的信号槽的话,这个还是值得讲一讲的,不然的话,可能会引起相应的误会. ...

  8. javascript获得给定日期的前一天的日期

    /** * 获得当前日期的前一天 */ function getYestoday(date){ var yesterday_milliseconds=date.getTime()-1000*60*60 ...

  9. CentOS 基础安装

    1. 下载了 CentOS 的最小安装版本 与 VMware,基础安装流程参考百度经验:http://jingyan.baidu.com/article/eae0782787b4c01fec54853 ...

  10. P1066 2^k进制数

    传送门 题目描述 设r是个2^k 进制数,并满足以下条件: (1)r至少是个2位的2^k 进制数. (2)作为2^k 进制数,除最后一位外,r的每一位严格小于它右边相邻的那一位. (3)将r转换为2进 ...