‰‚ß‚É lŽ@‚P lŽ@‚Q ‹›•ž‹Li‘¾ÉŽ¡jlŽ@ lŽ@‚S lŽ@‚T lŽ@‚U lŽ@‚V “ú‹L

SQLƒƒ‚

CREATE DATABASE emp_sys_db;

CREATE TABLE emp_sys_db.m_employee(

	emp_code		VARCHAR(4) PRIMARY KEY,
	l_name			VARCHAR(16) NOT NULL,
	f_name			VARCHAR(16) NOT NULL,
	l_kana_name		VARCHAR(24),
	f_kana_name		VARCHAR(24),
	sex				TINYINT(1),
	birth_day		DATE,
	section_code	VARCHAR(2),
	emp_date		DATE,
	update_day		TIMESTAMP NOT NULL
)ENGINE = INNODB;

CREATE TABLE emp_sys_db.m_section(
	
	section_code	VARCHAR(2) PRIMARY KEY,
	section_name	VARCHAR(24) NOT NULL,
	update_day		TIMESTAMP NOT NULL
)ENGINE = INNODB;


CREATE TABLE emp_sys_db.m_user(
	
	user_id			VARCHAR(24),
	password		VARCHAR(32),
	update_day		TIMESTAMP NOT NULL
)ENGINE = INNODB;

ALTER TABLE emp_sys_db.m_user ADD PRIMARY KEY(
	user_id,
	password
);

ALTER TABLE emp_sys_db.m_employee ADD FOREIGN KEY(
 	section_code
)REFERENCES m_section(
 	section_code
);





INSERT INTO emp_sys_db.m_user
VALUE(
	'root','root',null
);


INSERT INTO emp_sys_db.m_section 
VALUES(
	'01','ŠÇ—•”',null
);

INSERT INTO emp_sys_db.m_section
VALUES(
	'02','‰c‹Æ•”',null
);

INSERT INTO emp_sys_db.m_section
VALUES(
	'03','Šé‰æ•”',null
);


INSERT INTO emp_sys_db.m_employee
VALUES(
	'0001','ŽR“c','‘¾˜Y','ƒ„ƒ}ƒ_','ƒ^ƒƒE',0,19501011,'01',19700401,null
);