mysql实现联合查询视图的方法实例
mysql实现联合查询视图的方法实例
mysql>
mysql> create table employee(
-> id int,
-> first_name varchar(15),
-> last_name varchar(15),
-> start_date date,
-> end_date date,
-> salary float(8,2),
-> city varchar(10),
-> description varchar(15)
-> );
query ok, 0 rows affected (0.02 sec)
mysql>
mysql> create table job (
-> id int,
-> title varchar(20)
-> );
query ok, 0 rows affected (0.06 sec)
mysql>
mysql> insert into employee(id,first_name, last_name, start_date, end_date, salary, city, description)
-> values (1,'jason', 'martin', '19960725', '20060725', 1234.56, 'toronto', 'programmer');
query ok, 1 row affected (0.00 sec)
mysql>
mysql> insert into employee(id,first_name, last_name, start_date, end_date, salary, city, description)
-> values(2,'alison', 'mathews', '19760321', '19860221', 6661.78, 'vancouver','tester');
query ok, 1 row affected (0.00 sec)
mysql>
mysql> insert into employee(id,first_name, last_name, start_date, end_date, salary, city, description)
-> values(3,'james', 'smith', '19781212', '19900315', 6544.78, 'vancouver','tester');
query ok, 1 row affected (0.00 sec)
mysql>
mysql> insert into employee(id,first_name, last_name, start_date, end_date, salary, city, description)
-> values(4,'celia', 'rice', '19821024', '19990421', 2344.78, 'vancouver','manager');
query ok, 1 row affected (0.00 sec)
mysql>
mysql> insert into employee(id,first_name, last_name, start_date, end_date, salary, city, description)
-> values(5,'robert', 'black', '19840115', '19980808', 2334.78, 'vancouver','tester');
query ok, 1 row affected (0.01 sec)
mysql>
mysql> insert into employee(id,first_name, last_name, start_date, end_date, salary, city, description)
-> values(6,'linda', 'green', '19870730