Sun Restaurant--oracle---table---danrong

Source: Internet
Author: User

SELECT * FROM Manager;select * from Dish;select * from Board;select * to Employee;select * from Orders;select * from Ord Er_detail; --Menu Table CREATE table dish (Dishid number (Ten) primary key, Dishname varchar2 () not null unique, category VARCHAR2 (Ten) No T NULL, price number (TEN) not NULL, picture varchar2 (+) not NULL, status number (TEN) not NULL) create sequence Dish_se St Art with 1 increment by 1maxvalue 5000;insert to Dish (dishid,dishname,category,price,picture,status) VALUES (dish_ Se.nextval, ' xx ', ' xx ', ' xx ', ' xx ', ' xx '); select * FROM dish;--Administrator table create Table Manager (mid number) primary KEY, Mname VA RCHAR2 (1) NOT null Unique,password VARCHAR2 (TEN) NOT null) The Create sequence Manager_se start with increment by 1maxvalu  E 5000;insert into manager (Mid,mname,password) VALUES (manager_se.nextval, ' 1 ', ' 1 ');   SELECT * from manager; --Table CREATE TABLE Board (boardid number (Ten) primary key, capacity number (TEN) not NULL) Create sequence Board_se start W ITH 1 increment by 1maxvalue 5000INSERT into board (boardid,capacity) VALUES (Board_se.nextval, ' 4 '); SELECT * FROM board;--staff table CREATE TABLE employee (EID number primary key, Ename VARCHAR2 (TEN) NOT NULL, sex varchar 2 (Ten) not NULL, position VARCHAR2 (TEN) not NULL, Epassword VARCHAR2 (TEN) not NULL) Create sequence Emp_se start with 1 increment by 1maxvalue 5000;insert into employee (Eid,ename,sex,position,epassword) VALUES (emp_se.nextval, ' 1 ', ' Male ', ' Waiter ', ' 1 '); SELECT * from employee;--Creating order table CREATE table orders (OrderID number) primary key, Boardid number (TEN) not NULL,--foreign key p Number number (ten) is not NULL, client VARCHAR2 (10),--Allow null Mobile_number varchar2 (),--allow null order_time varchar2 (not N) ull, Arrive_time varchar2 () not NULL, cash number (ten), change number (ten), status number (TEN) NOT null)--FOREIGN KEY constraint Alter tab Le orders add constraint fk_order_boardid foreign key (boardid) references Board (boardid); Create sequence Order_se start With 1 increment by 1maxvalue 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;--Order Details table CREATE TABLE Order_Detail (Odid number) primary key, Orderi  D Number (TEN) not NULL,--FOREIGN key EID number (TEN) NOT NULL,--foreign key Dishid number () NOT NULL,--foreign key Taste number (TEN) NOT NULL, Price number (ten) not NULL, Count number (TEN) not NULL, status number (TEN) NOT null)--FOREIGN KEY constraint ALTER TABLE Order_Detail addcons Traint Fk_ordt_orderid foreign KEY (OrderID) references orders (OrderID); ALTER TABLE Order_Detail AddConstraint fk_ordt_e ID foreign KEY (Eid) references employee (EID); ALTER TABLE Order_Detail addconstraint fk_ordt_dishid foreign Key (Dishid) References Dish (dishid); create sequence ordt_se start with 1 increment by 1maxvalue 5000;insert into Order_Detail (odid,o Rderid,eid,dishid,taste,price,count,status) VALUES (ordt_se.nextval,1,1,3,1,10,1,1);

  

Sun Restaurant--oracle---table---danrong

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.