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. HttpClient 发送图片

    var httpClient = new HttpClient(); using (FileStream fs = new FileStream("C:\\1.jpg", File ...

  2. dom4j 笔记【转】

    SAXReader reader = new SAXReader(); Document doc = reader.read(...); List childNodes = doc.selectNod ...

  3. Smarty环境配置

    Smaty优点:1.代码分离 2.缓存技术 使用步骤: 1.下载Smaty模板 2.将模板中那个lib文件夹复制到项目中(一般为根目录,并且重命名在此命名为Smarty), 3.配置PHP 1.新建一 ...

  4. JavaScript--机选双色球

    <!doctype html> <html> <head> <meta charset="UTF-8"> <title> ...

  5. nodejs新手教程中upload file的问题

    可参见: http://cnodejs.org/topic/50234890f767cc9a51f88481 request.setEncoding("utf8");应注释掉.

  6. 【转载】Think as Customer 以客户为中心的测试理念

    纵观各大公司的核心理念,往往都有一条类似“以客户为中心”的价值观.华为公司更是把“以客户为中心”放在其核心价值观的第一条,以显示它的重要性.从我 们入职培训开始,公司就反复强调并引导大家深入讨论,希望 ...

  7. 14_RHEL7安装mplayer

    这里用nux-dextop仓库来配置 Nux Dextop桌面对CentOS和RHEL 6/7可用.它是一个面对CentOS.RHEL.ScientificLinux的含有许多流行的桌面和多媒体相关的 ...

  8. oracle触发器应用

    首先给大家推荐两篇我看后的博文,我已经内容转载过来: 1.对触发器的讲解 本篇主要内容如下: 8.1 触发器类型 8.1.1 DML触发器 8.1.2 替代触发器 8.1.3 系统触发器 8.2 创建 ...

  9. get_magic_quotes_gpc() 内置函数

    get_magic_quotes_gpc()函数 在PHP中是内置的函数,这个函数的作用就是得到php.ini设置中magic_quotes_gpc选项的值. 当magic_quotes_gpc=On ...

  10. php设计模式之简单工厂模式

    ①抽象基类:类中定义抽象一些方法,用以在子类中实现 ②继承自抽象基类的子类:实现基类中的抽象方法 ③工厂类:用以实例化所有相对应的子类 /** * * 定义个抽象的类,让子类去继承实现它 * */ a ...