CREATE DATABASE mall;
USE mall;
show databases;
create table member (
mem_id varchar(10) primary key,
mem_name varchar(10),
mem_phn_hm varchar(30),
mem_phn_mbl varchar(30),
mem_addr varchar(100),
mem_birth varchar(50),
mem_job varchar(50)
);
create table item (
itm_no varchar(10) primary key,
itm_name varchar(20),
itm_content text,
itm_price varchar(30),
itm_sup_price varchar(30),
itm_date date,
itm_exp varchar(30),
itm_category varchar(50)
);
-- 컬럼 타입 변경
alter table item modify itm_price int;
alter table item modify itm_sup_price int;
drop table item;
create table employee (
emp_id varchar(10) primary key,
emp_name varchar(20),
emp_sex char(1) CHECK (emp_sex IN ('M', 'F')),
emp_dept varchar(20),
emp_regDate varchar(30)
);
create table order_list (
ord_no varchar(10) primary key,
mem_id varchar(10),
itm_no varchar(10),
ord_date date,
ord_qty int,
ord_ord_price int,
FOREIGN KEY (mem_id) REFERENCES member(mem_id),
FOREIGN KEY (itm_no) REFERENCES item(itm_no)
);
drop table order_list;
create table production (
prod_no varchar(10) primary key,
itm_no varchar(10),
comp_no varchar(10),
prod_date date,
FOREIGN KEY (itm_no) REFERENCES item(itm_no),
FOREIGN KEY (comp_no) REFERENCES company(comp_no)
);
create table company (
comp_no varchar(10) primary key,
comp_name varchar(20),
comp_addr varchar(50),
comp_pc varchar(10),
comp_phn varchar(50),
comp_email varchar(50),
comp_hp varchar(100),
emp_id varchar(10),
FOREIGN KEY (emp_id) REFERENCES employee(emp_id)
);
select * from member;
수정하려는데 계속 오류남..ㅡㅡ
무슨 안전장치 때문이라는데
SET SQL_SAFE_UPDATES = 0;
이거랑 설정가서ㅓ
해제해주니까 된다
흠 오라클로 먼저 배워서 오라클이 더 편해ㅜㅜ쒸