CREATE DATABASE HISDB;
USE hisdb;
CREATE TABLE doctor (
dID VARCHAR (6) NOT NULL PRIMARY KEY,
dName VARCHAR (10) NOT NULL,
Title VARCHAR (10),
Department VARCHAR (10),
Assistant VARCHAR (10)
) ;
CREATE TABLE patient (
pID VARCHAR (10) NOT NULL PRIMARY KEY,
pName VARCHAR (10) NOT NULL,
sex VARCHAR (5),
Job VARCHAR (30),
tel VARCHAR (13),
Birth DATETIME
) ;
CREATE TABLE curefee (
pID VARCHAR (10) NOT NULL PRIMARY KEY,
dID VARCHAR (10) NOT NULL,
fee INT DEFAULT 0
) ;
INSERT INTO doctor VALUES('d1','王丹','主任医生','内科','d3'),
('d2','刘秀','主治医生','五官科','d6'),
('d3','张景','实习医生','内科',''),
('d4','李灿','主任医生','呼吸科','d5'),
('d5','朱诚','实习医生','呼吸科',''),
('d6','汪力','实习医生','五官科','');
SELECT * FROM doctor;
SELECT * FROM curefee;
SELECT * FROM patient;
INSERT INTO Patient
VALUES
(
'p1',
'曾范',
'男',
'司机',
'13870451234',
'1980-01-11'
),
(
'p2',
'刘丽',
'女',
'教师',
'13870959385',
'1970-09-14'
),
(
'p3',
'项羽',
'男',
'个体户',
'13070451233',
'1950-07-17'
),
(
'p4',
'张飞',
'女',
'职员',
'13970451237',
'1980-12-11'
),
(
'p5',
'关羽',
'男',
'学生',
'13854451934',
'1960-11-24'
),
(
'p6',
'曹操',
'女',
'经理',
'13780451232',
'1968-11-22'
) ;
INSERT INTO CureFee
VALUES
('p1', 'd1', '2000'),
('p2', 'd2', '500'),
('p3', 'd1', '2000'),
('p4', 'd2', '5000'),
('p5', 'd4', '1000'),
('p6', 'd4', '12000') ;