粤嵌打卡第27天(Mysql数据库面试习题------查询)

今天我们来聊聊Mysql数据库的常见题型吧!!!

我们先来创建数据:

CREATE DATABASE store;

USE store;

-- create the tables
CREATE TABLE customers (
  customer_id INTEGER PRIMARY KEY,
  first_name VARCHAR(10) NOT NULL,
  last_name VARCHAR(10) NOT NULL,
  dob DATE,
  phone VARCHAR(12)
);

CREATE TABLE product_types (
  product_type_id INTEGER PRIMARY KEY,
  NAME VARCHAR(10) NOT NULL
);

CREATE TABLE products (
  product_id INTEGER PRIMARY KEY,
  product_type_id INTEGER
    REFERENCES product_types(product_type_id),
  NAME VARCHAR(30) NOT NULL,
  description VARCHAR(50),
  price DECIMAL(5, 2)
);

CREATE TABLE purchases (
  product_id INTEGER
    REFERENCES products(product_id),
  customer_id INTEGER
    REFERENCES customers(customer_id),
  quantity INTEGER NOT NULL,
  CONSTRAINT purchases_pk PRIMARY KEY (product_id, customer_id)
);

CREATE TABLE employees (
  employee_id INTEGER PRIMARY KEY,
  manager_id INTEGER,
  first_name VARCHAR(10) NOT NULL,
  last_name VARCHAR(10) NOT NULL,
  title VARCHAR(20),
  salary DECIMAL(6, 0)
);

CREATE TABLE salary_grades (
  salary_grade_id INTEGER PRIMARY KEY,
  low_salary DECIMAL(6, 0),
  high_salary DECIMAL(6, 0)
);


CREATE TABLE product_changes (
  product_id INTEGER PRIMARY KEY,
  product_type_id INTEGER
    REFERENCES product_types(product_type_id),
  NAME VARCHAR(30) NOT NULL,
  description VARCHAR(50),
  price DECIMAL(5, 2)
);

CREATE TABLE more_products (
  prd_id INTEGER PRIMARY KEY,
  prd_type_id INTEGER REFERENCES product_types(product_type_id),
  NAME VARCHAR(30) NOT NULL,
  available CHAR(1)
);

CREATE TABLE more_employees (
  employee_id INTEGER PRIMARY KEY,
  manager_id INTEGER
    REFERENCES more_employees(employee_id),
  first_name VARCHAR(10) NOT NULL,
  last_name VARCHAR(10) NOT NULL,
  title VARCHAR(20),
  salary DECIMAL(6, 0)
);

CREATE TABLE divisions (
  division_id CHAR(3) PRIMARY KEY,
  NAME VARCHAR(15) NOT NULL
);

CREATE TABLE jobs (
  job_id CHAR(3) PRIMARY KEY,
  NAME VARCHAR(20) NOT NULL
);

CREATE TABLE employees2 (
  employee_id INTEGER PRIMARY KEY,
  division_id CHAR(3)
    REFERENCES divisions(division_id),
  job_id CHAR(3) REFERENCES jobs(job_id),
  first_name VARCHAR(10) NOT NULL,
  last_name VARCHAR(10) NOT NULL,
  salary DECIMAL(6, 0)
);

CREATE TABLE all_sales (
  YEAR INTEGER NOT NULL,
  MONTH INTEGER NOT NULL,
  prd_type_id INTEGER
    REFERENCES product_types(product_type_id),
  emp_id INTEGER
    REFERENCES employees2(employee_id),
  amount DECIMAL(8, 2),
  CONSTRAINT all_sales_pk PRIMARY KEY (
    YEAR, MONTH, prd_type_id, emp_id
  )
);

-- insert sample data into customers table
INSERT INTO customers (
  customer_id, first_name, last_name, dob, phone
) VALUES (
  1, 'John', 'Brown', '1965-01-01', '800-555-1211'
);

INSERT INTO customers (
  customer_id, first_name, last_name, dob, phone
) VALUES (
  2, 'Cynthia', 'Green', '1968-02-05', '800-555-1212'
);

INSERT INTO customers (
  customer_id, first_name, last_name, dob, phone
) VALUES (
  3, 'Steve', 'White', '1971-3-16', '800-555-1213'
);

INSERT INTO customers (
  customer_id, first_name, last_name, dob, phone
) VALUES (
  4, 'Gail', 'Black', NULL, '800-555-1214'
);

INSERT INTO customers (
  customer_id, first_name, last_name, dob, phone
) VALUES (
  5, 'Doreen', 'Blue', '1970-05-20', NULL
);

-- commit the transaction
COMMIT;

-- insert sample data into product_types table
INSERT INTO product_types (
  product_type_id, NAME
) VALUES (
  1, 'Book'
);

INSERT INTO product_types (
  product_type_id, NAME
) VALUES (
  2, 'Video'
);

INSERT INTO product_types (
  product_type_id, NAME
) VALUES (
  3, 'DVD'
);

INSERT INTO product_types (
  product_type_id, NAME
) VALUES (
  4, 'CD'
);

INSERT INTO product_types (
  product_type_id, NAME
) VALUES (
  5, 'Magazine'
);

-- commit the transaction
COMMIT;

-- insert sample data into products table
INSERT INTO products (
  product_id, product_type_id, NAME, description, price
) VALUES (
  1, 1, 'Modern Science', 'A description of modern science', 19.95
);

INSERT INTO products (
  product_id, product_type_id, NAME, description, price
) VALUES (
  2, 1, 'Chemistry', 'Introduction to Chemistry', 30.00
);

INSERT INTO products (
  product_id, product_type_id, NAME, description, price
) VALUES (
  3, 2, 'Supernova', 'A star explodes', 25.99
);

INSERT INTO products (
  product_id, product_type_id, NAME, description, price
) VALUES (
  4, 2, 'Tank War', 'Action movie about a future war', 13.95
);

INSERT INTO products (
  product_id, product_type_id, NAME, description, price
) VALUES (
  5, 2, 'Z Files', 'Series on mysterious activities', 49.99
);

INSERT INTO products (
  product_id, product_type_id, NAME, description, price
) VALUES (
  6, 2, '2412: The Return', 'Aliens return', 14.95
);

INSERT INTO products (
  product_id, product_type_id, NAME, description, price
)
VALUES (
  7, 3, 'Space Force 9', 'Adventures of heroes', 13.49
);

INSERT INTO products (
  product_id, product_type_id, NAME, description, price
) VALUES (
  8, 3, 'From Another Planet', 'Alien from another planet lands on Earth', 12.99
);

INSERT INTO products (
  product_id, product_type_id, NAME, description, price
) VALUES (
  9, 4, 'Classical Music', 'The best classical music', 10.99
);

INSERT INTO products (
  product_id, product_type_id, NAME, description, price
) VALUES (
  10, 4, 'Pop 3', 'The best popular music', 15.99
);

INSERT INTO products (
  product_id, product_type_id, NAME, description, price
) VALUES (
  11, 4, 'Creative Yell', 'Debut album', 14.99
);

INSERT INTO products (
  product_id, product_type_id, NAME, description, price
) VALUES (
  12, NULL, 'My Front Line', 'Their greatest hits', 13.49
);

-- commit the transaction
COMMIT;

-- insert sample data into purchases table
INSERT INTO purchases (
  product_id, customer_id, quantity
) VALUES (
  1, 1, 1
);

INSERT INTO purchases (
  product_id, customer_id, quantity
) VALUES (
  2, 1, 3
);

INSERT INTO purchases (
  product_id, customer_id, quantity
) VALUES (
  1, 4, 1
);

INSERT INTO purchases (
  product_id, customer_id, quantity
) VALUES (
  2, 2, 1
);

INSERT INTO purchases (
  product_id, customer_id, quantity
) VALUES (
  1, 3, 1
);

INSERT INTO purchases (
  product_id, customer_id, quantity
) VALUES (
  1, 2, 2
);

INSERT INTO purchases (
  product_id, customer_id, quantity
) VALUES (
  2, 3, 1
);

INSERT INTO purchases (
  product_id, customer_id, quantity
) VALUES (
  2, 4, 1
);

INSERT INTO purchases (
  product_id, customer_id, quantity
) VALUES (
  3, 3, 1
);

-- commit the transaction
COMMIT;

-- insert sample data into employees table
INSERT INTO employees (
  employee_id, manager_id, first_name, last_name, title, salary
) VALUES (
  1, NULL, 'James', 'Smith', 'CEO', 800000
);

INSERT INTO employees (
  employee_id, manager_id, first_name, last_name, title, salary
) VALUES (
  2, 1, 'Ron', 'Johnson', 'Sales Manager', 600000
);

INSERT INTO employees (
  employee_id, manager_id, first_name, last_name, title, salary
) VALUES (
  3, 2, 'Fred', 'Hobbs', 'Salesperson', 150000
);

INSERT INTO employees (
  employee_id, manager_id, first_name, last_name, title, salary
) VALUES (
  4, 2, 'Susan', 'Jones', 'Salesperson', 500000
);

-- commit the transaction
COMMIT;

-- insert sample data into salary_grade table
INSERT INTO salary_grades (
  salary_grade_id, low_salary, high_salary
) VALUES (
  1, 1, 250000
);

INSERT INTO salary_grades (
  salary_grade_id, low_salary, high_salary
) VALUES (
  2, 250001, 500000
);

INSERT INTO salary_grades (
  salary_grade_id, low_salary, high_salary
) VALUES (
  3, 500001, 750000
);

INSERT INTO salary_grades (
  salary_grade_id, low_salary, high_salary
) VALUES (
  4, 750001, 999999
);

-- commit the transaction
COMMIT;

-- insert sample data into product_changes table
INSERT INTO product_changes (
  product_id, product_type_id, NAME, description, price
) VALUES (
  1, 1, 'Modern Science', 'A description of modern science', 40.00
);

INSERT INTO product_changes (
  product_id, product_type_id, NAME, description, price
) VALUES (
  2, 1, 'New Chemistry', 'Introduction to Chemistry', 35.00
);

INSERT INTO product_changes (
  product_id, product_type_id, NAME, description, price
) VALUES (
  3, 1, 'Supernova', 'A star explodes', 25.99
);

INSERT INTO product_changes (
  product_id, product_type_id, NAME, description, price
) VALUES (
  13, 2, 'Lunar Landing', 'Documentary', 15.99
);

INSERT INTO product_changes (
  product_id, product_type_id, NAME, description, price
) VALUES (
  14, 2, 'Submarine', 'Documentary', 15.99
);

INSERT INTO product_changes (
  product_id, product_type_id, NAME, description, price
) VALUES (
  15, 2, 'Airplane', 'Documentary', 15.99
);

-- commit the transaction
COMMIT;

-- insert sample data into more_products table
INSERT INTO more_products (
  prd_id, prd_type_id, NAME, available
) VALUES (
  1, 1, 'Modern Science', 'Y'
);

INSERT INTO more_products (
  prd_id, prd_type_id, NAME, available
) VALUES (
  2, 1, 'Chemistry', 'Y'
);

INSERT INTO more_products (
  prd_id, prd_type_id, NAME, available
) VALUES (
  3, NULL, 'Supernova', 'N'
);

INSERT INTO more_products (
  prd_id, prd_type_id, NAME, available
) VALUES (
  4, 2, 'Lunar Landing', 'N'
);

INSERT INTO more_products (
  prd_id, prd_type_id, NAME, available
) VALUES (
  5, 2, 'Submarine', 'Y'
);

-- commit the transaction
COMMIT;

-- insert sample data into more_employees table
INSERT INTO more_employees (
  employee_id, manager_id, first_name, last_name, title, salary
) VALUES (
  1, NULL, 'James', 'Smith', 'CEO', 800000
);
     
INSERT INTO more_employees (
  employee_id, manager_id, first_name, last_name, title, salary
) VALUES (
  2, 1, 'Ron', 'Johnson', 'Sales Manager', 600000
);

INSERT INTO more_employees (
  employee_id, manager_id, first_name, last_name, title, salary
) VALUES (
  3, 2, 'Fred', 'Hobbs', 'Sales Person', 200000
);

INSERT INTO more_employees (
  employee_id, manager_id, first_name, last_name, title, salary
) VALUES (
  4, 1, 'Susan', 'Jones', 'Support Manager', 500000
);

INSERT INTO more_employees (
  employee_id, manager_id, first_name, last_name, title, salary
) VALUES (
  5, 2, 'Rob', 'Green', 'Sales Person', 40000
);

INSERT INTO more_employees (
  employee_id, manager_id, first_name, last_name, title, salary
) VALUES (
  6, 4, 'Jane', 'Brown', 'Support Person', 45000
);

INSERT INTO more_employees (
  employee_id, manager_id, first_name, last_name, title, salary
) VALUES (
  7, 4, 'John', 'Grey', 'Support Manager', 30000
);

INSERT INTO more_employees (
  employee_id, manager_id, first_name, last_name, title, salary
) VALUES (
  8, 7, 'Jean', 'Blue', 'Support Person', 29000
);

INSERT INTO more_employees (
  employee_id, manager_id, first_name, last_name, title, salary
) VALUES (
  9, 6, 'Henry', 'Heyson', 'Support Person', 30000
);

INSERT INTO more_employees (
  employee_id, manager_id, first_name, last_name, title, salary
) VALUES (
  10, 1, 'Kevin', 'Black', 'Ops Manager', 100000
);

INSERT INTO more_employees (
  employee_id, manager_id, first_name, last_name, title, salary
) VALUES (
  11, 10, 'Keith', 'Long', 'Ops Person', 50000
);

INSERT INTO more_employees (
  employee_id, manager_id, first_name, last_name, title, salary
) VALUES (
  12, 10, 'Frank', 'Howard', 'Ops Person', 45000
);

INSERT INTO more_employees (
  employee_id, manager_id, first_name, last_name, title, salary
) VALUES (
  13, 10, 'Doreen', 'Penn', 'Ops Person', 47000
);

-- commit the transaction
COMMIT;

-- insert sample data into divisions table
INSERT INTO divisions (
  division_id, NAME
) VALUES (
  'SAL', 'Sales'
);

INSERT INTO divisions (
  division_id, NAME
) VALUES (
  'OPE', 'Operations'
);

INSERT INTO divisions (
  division_id, NAME
) VALUES (
  'SUP', 'Support'
);

INSERT INTO divisions (
  division_id, NAME
) VALUES (
  'BUS', 'Business'
);

-- commit the transaction
COMMIT;

-- insert sample data into jobs table
INSERT INTO jobs (
  job_id, NAME
) VALUES (
  'WOR', 'Worker'
);

INSERT INTO jobs (
  job_id, NAME
) VALUES (
  'MGR', 'Manager'
);

INSERT INTO jobs (
  job_id, NAME
) VALUES (
  'ENG', 'Engineer'
);

INSERT INTO jobs (
  job_id, NAME
) VALUES (
  'TEC', 'Technologist'
);

INSERT INTO jobs (
  job_id, NAME
) VALUES (
  'PRE', 'President'
);

-- commit the transaction
COMMIT;

-- insert sample data into employees2 table
INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  1, 'BUS', 'PRE', 'James', 'Smith', 800000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  2, 'SAL', 'MGR', 'Ron', 'Johnson', 350000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  3, 'SAL', 'WOR', 'Fred', 'Hobbs', 140000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  4, 'SUP', 'MGR', 'Susan', 'Jones', 200000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  5, 'SAL', 'WOR', 'Rob', 'Green', 350000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  6, 'SUP', 'WOR', 'Jane', 'Brown', 200000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  7, 'SUP', 'MGR', 'John', 'Grey', 265000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  8, 'SUP', 'WOR', 'Jean', 'Blue', 110000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  9, 'SUP', 'WOR', 'Henry', 'Heyson', 125000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  10, 'OPE', 'MGR', 'Kevin', 'Black', 225000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  11, 'OPE', 'MGR', 'Keith', 'Long', 165000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  12, 'OPE', 'WOR', 'Frank', 'Howard', 125000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  13, 'OPE', 'WOR', 'Doreen', 'Penn', 145000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  14, 'BUS', 'MGR', 'Mark', 'Smith', 155000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  15, 'BUS', 'MGR', 'Jill', 'Jones', 175000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  16, 'OPE', 'ENG', 'Megan', 'Craig', 245000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  17, 'SUP', 'TEC', 'Matthew', 'Brant', 115000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  18, 'OPE', 'MGR', 'Tony', 'Clerke', 200000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  19, 'BUS', 'MGR', 'Tanya', 'Conway', 200000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  20, 'OPE', 'MGR', 'Terry', 'Cliff', 215000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  21, 'SAL', 'MGR', 'Steve', 'Green', 275000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  22, 'SAL', 'MGR', 'Roy', 'Red', 375000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  23, 'SAL', 'MGR', 'Sandra', 'Smith', 335000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  24, 'SAL', 'MGR', 'Gail', 'Silver', 225000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  25, 'SAL', 'MGR', 'Gerald', 'Gold', 245000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  26, 'SAL', 'MGR', 'Eileen', 'Lane', 235000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  27, 'SAL', 'MGR', 'Doreen', 'Upton', 235000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  28, 'SAL', 'MGR', 'Jack', 'Ewing', 235000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  29, 'SAL', 'MGR', 'Paul', 'Owens', 245000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  30, 'SAL', 'MGR', 'Melanie', 'York', 255000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  31, 'SAL', 'MGR', 'Tracy', 'Yellow', 225000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  32, 'SAL', 'MGR', 'Sarah', 'White', 235000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  33, 'SAL', 'MGR', 'Terry', 'Iron', 225000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  34, 'SAL', 'MGR', 'Christine', 'Brown', 247000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  35, 'SAL', 'MGR', 'John', 'Brown', 249000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  36, 'SAL', 'MGR', 'Kelvin', 'Trenton', 255000
);

INSERT INTO employees2 (
  employee_id, division_id, job_id, first_name, last_name, salary
) VALUES (
  37, 'BUS', 'WOR', 'Damon', 'Jones', 280000
);

-- commit the transaction
COMMIT;

-- insert sample data into all_sales table
INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 1, 2003, 1, 10034.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 1, 2003, 2, 15144.65
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 1, 2003, 3, 20137.83
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 1, 2003, 4, 25057.45
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 1, 2003, 5, 17214.564
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 1, 2003, 6, 15564.64
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 1, 2003, 7, 12654.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 1, 2003, 8, 17434.82
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 1, 2003, 9, 19854.57
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 1, 2003, 10, 21754.19
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 1, 2003, 11, 13029.73
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 1, 2003, 12, 10034.84
);


INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 2, 2003, 1, 1034.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 2, 2003, 2, 1544.65
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 2, 2003, 3, 2037.83
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 2, 2003, 4, 2557.45
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 2, 2003, 5, 1714.564
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 2, 2003, 6, 1564.64
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 2, 2003, 7, 1264.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 2, 2003, 8, 1734.82
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 2, 2003, 9, 1854.57
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 2, 2003, 10, 2754.19
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 2, 2003, 11, 1329.73
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 2, 2003, 12, 1034.84
);


INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 3, 2003, 1, 6034.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 3, 2003, 2, 1944.65
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 3, 2003, 3, 2537.83
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 3, 2003, 4, 4557.45
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 3, 2003, 5, 3714.564
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 3, 2003, 6, 3564.64
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 3, 2003, 7, 21264.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 3, 2003, 8, 21734.82
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 3, 2003, 9, 12854.57
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 3, 2003, 10, 32754.19
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 3, 2003, 11, 15329.73
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 3, 2003, 12, 14034.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 4, 2003, 1, 3034.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 4, 2003, 2, 2944.65
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 4, 2003, 3, 5537.83
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 4, 2003, 4, 3557.45
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 4, 2003, 5, 2714.564
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 4, 2003, 6, 7564.64
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 4, 2003, 7, 1264.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 4, 2003, 8, 21734.82
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 4, 2003, 9, 14854.57
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 4, 2003, 10, 22754.19
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 4, 2003, 11, 11329.73
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 4, 2003, 12, 11034.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 1, 2003, 1, 11034.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 1, 2003, 2, 16144.65
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 1, 2003, 3, 24137.83
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 1, 2003, 4, 29057.45
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 1, 2003, 5, 19214.564
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 1, 2003, 6, 16564.64
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 1, 2003, 7, 13654.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 1, 2003, 8, 17834.82
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 1, 2003, 9, 21854.57
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 1, 2003, 10, 18754.19
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 1, 2003, 11, 16529.73
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 1, 2003, 12, 9434.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 2, 2003, 1, 1234.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 2, 2003, 2, 1044.65
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 2, 2003, 3, 2537.83
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 2, 2003, 4, 2657.45
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 2, 2003, 5, 1314.56
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 2, 2003, 6, 1264.64
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 2, 2003, 7, 1964.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 2, 2003, 8, 1234.82
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 2, 2003, 9, 1954.57
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 2, 2003, 10, 2254.19
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 2, 2003, 11, 1229.73
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 2, 2003, 12, 1134.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 3, 2003, 1, 6334.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 3, 2003, 2, 1544.65
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 3, 2003, 3, 2737.83
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 3, 2003, 4, 4657.45
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 3, 2003, 5, 3714.56
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 3, 2003, 6, 3864.64
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 3, 2003, 7, 27264.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 3, 2003, 8, 17734.82
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 3, 2003, 9, 10854.57
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 3, 2003, 10, 15754.19
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 3, 2003, 11, 10329.73
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 3, 2003, 12, 12034.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 4, 2003, 1, 3334.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 4, 2003, 2, 2344.65
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 4, 2003, 3, 5137.83
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 4, 2003, 4, 3157.45
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 4, 2003, 5, 2114.564
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 4, 2003, 6, 7064.64
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 4, 2003, 7, 1564.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 4, 2003, 8, 12734.82
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 4, 2003, 9, 10854.57
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 4, 2003, 10, 20754.19
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 4, 2003, 11, 10329.73
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 4, 2003, 12, 2034.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 1, 2003, 1, 4034.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 1, 2003, 2, 7144.65
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 1, 2003, 3, 12137.83
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 1, 2003, 4, 16057.45
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 1, 2003, 5, 13214.564
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 1, 2003, 6, 3564.64
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 1, 2003, 7, 7654.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 1, 2003, 8, 5834.82
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 1, 2003, 9, 6754.57
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 1, 2003, 10, 12534.19
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 1, 2003, 11, 2529.73
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 1, 2003, 12, 7434.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 2, 2003, 1, 1234.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 2, 2003, 2, 2244.65
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 2, 2003, 3, 2137.83
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 2, 2003, 4, 2357.45
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 2, 2003, 5, 1314.56
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 2, 2003, 6, 1364.64
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 2, 2003, 7, 1364.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 2, 2003, 8, 1334.82
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 2, 2003, 9, 1354.57
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 2, 2003, 10, 2354.19
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 2, 2003, 11, 1329.73
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 2, 2003, 12, 1334.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 3, 2003, 1, 6334.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 3, 2003, 2, 1344.65
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 3, 2003, 3, 2337.83
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 3, 2003, 4, 4357.45
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 3, 2003, 5, 3314.56
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 3, 2003, 6, 3364.64
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 3, 2003, 7, 23264.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 3, 2003, 8, 13734.82
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 3, 2003, 9, 13854.57
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 3, 2003, 10, 13754.19
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 3, 2003, 11, 13329.73
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 3, 2003, 12, 13034.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 4, 2003, 1, 3334.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 4, 2003, 2, 2344.65
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 4, 2003, 3, 5337.83
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 4, 2003, 4, 3357.45
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 4, 2003, 5, 2314.564
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 4, 2003, 6, 7364.64
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 4, 2003, 7, 1364.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 4, 2003, 8, 13734.82
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 4, 2003, 9, 13854.57
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 4, 2003, 10, 23754.19
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 4, 2003, 11, 13329.73
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 4, 2003, 12, 2334.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 1, 2003, 1, 7034.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 1, 2003, 2, 17144.65
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 1, 2003, 3, 22137.83
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 1, 2003, 4, 24057.45
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 1, 2003, 5, 25214.564
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 1, 2003, 6, 14564.64
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 1, 2003, 7, 17654.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 1, 2003, 8, 15834.82
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 1, 2003, 9, 15854.57
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 1, 2003, 10, 22754.19
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 1, 2003, 11, 14529.73
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 1, 2003, 12, 10434.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 2, 2003, 1, 1934.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 2, 2003, 2, 2844.65
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 2, 2003, 3, 2837.83
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 2, 2003, 4, 2697.45
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 2, 2003, 5, 7314.56
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 2, 2003, 6, 1864.64
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 2, 2003, 7, 2364.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 2, 2003, 8, 4334.82
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 2, 2003, 9, 6654.57
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 2, 2003, 10, 2254.19
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 2, 2003, 11, 5429.73
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 2, 2003, 12, 3334.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 3, 2003, 1, 2334.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 3, 2003, 2, 4544.65
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 3, 2003, 3, 6337.83
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 3, 2003, 4, 3357.45
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 3, 2003, 5, 2314.56
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 3, 2003, 6, 1364.64
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 3, 2003, 7, 5264.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 3, 2003, 8, 1734.82
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 3, 2003, 9, 1854.57
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 3, 2003, 10, 1354.19
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 3, 2003, 11, 1332.73
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 3, 2003, 12, 3034.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 4, 2003, 1, 3364.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 4, 2003, 2, 4344.65
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 4, 2003, 3, 4337.83
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 4, 2003, 4, 2357.45
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 4, 2003, 5, 6314.564
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 4, 2003, 6, 4364.64
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 4, 2003, 7, 2364.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 4, 2003, 8, 3734.82
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 4, 2003, 9, 3854.57
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 4, 2003, 10, 3754.19
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 4, 2003, 11, 1329.73
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 4, 2003, 12, 7334.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 1, 2003, 1, 1234.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 1, 2003, 2, 6144.65
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 1, 2003, 3, 8137.83
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 1, 2003, 4, 14057.45
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 1, 2003, 5, 12214.564
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 1, 2003, 6, 4564.64
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 1, 2003, 7, 5654.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 1, 2003, 8, 8834.82
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 1, 2003, 9, 10854.57
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 1, 2003, 10, 12754.19
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 1, 2003, 11, 3529.73
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 1, 2003, 12, 5434.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 2, 2003, 1, 3434.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 2, 2003, 2, 1844.65
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 2, 2003, 3, 2137.83
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 2, 2003, 4, 1697.45
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 2, 2003, 5, 4314.56
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 2, 2003, 6, 3264.64
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 2, 2003, 7, 5364.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 2, 2003, 8, 3334.82
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 2, 2003, 9, 2654.57
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 2, 2003, 10, 454.19
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 2, 2003, 11, 2429.73
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 2, 2003, 12, 1334.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 3, 2003, 1, 1434.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 3, 2003, 2, 3544.65
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 3, 2003, 3, 1337.83
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 3, 2003, 4, 1457.45
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 3, 2003, 5, 1314.56
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 3, 2003, 6, 4364.64
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 3, 2003, 7, 1264.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 3, 2003, 8, 2734.82
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 3, 2003, 9, 4354.57
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 3, 2003, 10, 2354.19
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 3, 2003, 11, 3432.73
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 3, 2003, 12, 1534.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 4, 2003, 1, 1164.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 4, 2003, 2, 2144.65
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 4, 2003, 3, 4337.83
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 4, 2003, 4, 1357.45
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 4, 2003, 5, 2314.564
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 4, 2003, 6, 2364.64
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 4, 2003, 7, 3264.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 4, 2003, 8, 2234.82
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 4, 2003, 9, 3454.57
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 4, 2003, 10, 2754.19
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 4, 2003, 11, 3429.73
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 4, 2003, 12, 4334.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 1, 2003, 1, 5534.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 1, 2003, 2, 8844.65
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 1, 2003, 3, 5137.83
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 1, 2003, 4, 12057.45
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 1, 2003, 5, 10214.564
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 1, 2003, 6, 2564.64
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 1, 2003, 7, 3654.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 1, 2003, 8, 9834.82
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 1, 2003, 9, 9854.57
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 1, 2003, 10, 16754.27
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 1, 2003, 11, 5529.73
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 1, 2003, 12, 3434.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 2, 2003, 1, 5434.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 2, 2003, 2, 3844.65
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 2, 2003, 3, 5137.83
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 2, 2003, 4, 3697.45
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 2, 2003, 5, 2314.56
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 2, 2003, 6, 5264.64
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 2, 2003, 7, 3364.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 2, 2003, 8, 4334.82
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 2, 2003, 9, 4654.57
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 2, 2003, 10, 3454.19
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 2, 2003, 11, 4429.19
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 2, 2003, 12, 4334.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 3, 2003, 1, 2434.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 3, 2003, 2, 2544.65
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 3, 2003, 3, 5337.83
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 3, 2003, 4, 5457.45
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 3, 2003, 5, 4314.56
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 3, 2003, 6, 3364.64
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 3, 2003, 7, 3264.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 3, 2003, 8, 4734.82
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 3, 2003, 9, 2354.57
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 3, 2003, 10, 4354.34
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 3, 2003, 11, 2432.73
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 3, 2003, 12, 4534.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 4, 2003, 1, 3164.23
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 4, 2003, 2, 3144.65
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 4, 2003, 3, 6337.83
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 4, 2003, 4, 2357.45
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 4, 2003, 5, 4314.564
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 4, 2003, 6, 4364.64
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 4, 2003, 7, 2264.84
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 4, 2003, 8, 4234.82
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 4, 2003, 9, 2454.57
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 4, 2003, 10, 1554.19
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 4, 2003, 11, 2429.73
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 4, 2003, 12, 3334.85
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 5, 2003, 1, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 5, 2003, 2, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 5, 2003, 3, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 5, 2003, 4, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 5, 2003, 5, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 5, 2003, 6, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 5, 2003, 7, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 5, 2003, 8, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 5, 2003, 9, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 5, 2003, 10, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 5, 2003, 11, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  21, 5, 2003, 12, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 5, 2003, 1, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 5, 2003, 2, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 5, 2003, 3, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 5, 2003, 4, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 5, 2003, 5, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 5, 2003, 6, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 5, 2003, 7, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 5, 2003, 8, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 5, 2003, 9, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 5, 2003, 10, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 5, 2003, 11, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  22, 5, 2003, 12, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 5, 2003, 1, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 5, 2003, 2, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 5, 2003, 3, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 5, 2003, 4, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 5, 2003, 5, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 5, 2003, 6, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 5, 2003, 7, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 5, 2003, 8, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 5, 2003, 9, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 5, 2003, 10, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 5, 2003, 11, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  23, 5, 2003, 12, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 5, 2003, 1, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 5, 2003, 2, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 5, 2003, 3, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 5, 2003, 4, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 5, 2003, 5, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 5, 2003, 6, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 5, 2003, 7, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 5, 2003, 8, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 5, 2003, 9, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 5, 2003, 10, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 5, 2003, 11, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  24, 5, 2003, 12, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 5, 2003, 1, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 5, 2003, 2, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 5, 2003, 3, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 5, 2003, 4, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 5, 2003, 5, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 5, 2003, 6, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 5, 2003, 7, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 5, 2003, 8, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 5, 2003, 9, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 5, 2003, 10, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 5, 2003, 11, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  25, 5, 2003, 12, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 5, 2003, 1, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 5, 2003, 2, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 5, 2003, 3, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 5, 2003, 4, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 5, 2003, 5, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 5, 2003, 6, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 5, 2003, 7, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 5, 2003, 8, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 5, 2003, 9, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 5, 2003, 10, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 5, 2003, 11, NULL
);

INSERT INTO all_sales (
  emp_id, prd_type_id, YEAR, MONTH, amount
) VALUES (
  26, 5, 2003, 12, NULL
);

-- commit the transaction
COMMIT;
-- 查看表结构
DESC customers;
DESC products;
DESC employees;
DESC products;
SELECT * FROM employees;

(1) 检索customers表中的编号、出生日期、电话列的值。

SELECT customer_id,dob,phone FROM customers;

(2) 检索products表中的产品编号、产品名、价格,同时输出每个产品7折后的价格。

SELECT product_id,NAME,price,price*0.7 AS '七折后的价格' FROM products;

(3) 检索products表中的价格小于25元的产品信息。

SELECT description FROM products WHERE price<25;

(4) 检索customers表中编号大于3 的用户的信息,并输出行号和行标识符。

SELECT * ,@rownum:=@rownum+1 rownum FROM customers,(SELECT @rownum:=0) b WHERE customer_id>3;

(5) 检索employees表中工资大于1000的员工编号、姓名、职务和工资,并为输出列定义别名:ID,NAME,TITLE,SALARY。

SELECT e.employee_id AS ID,CONCAT (e.first_name,e.last_name) AS NAME,e.title AS TITLE,e.salary AS SALARY FROM employees e WHERE SALARY>1000;

(6) 检索employees表中,编号为2的管理者手下的所有员工的信息。

SELECT e.* FROM employees e WHERE employee_id=2;

(7) 检索employees表中,编号为2和4的员工信息。

SELECT e.* FROM employees e WHERE employee_id IN(2,4);

(8)检索用户表中last_name以’B’开头的用户的所有信息。

SELECT c.* FROM customers c WHERE last_name LIKE'B%';

(9)检索用户表中first_name中包含’i’ 的用户的所有信息。

SELECT c.* FROM customers c WHERE first_name LIKE '%i%';

(10)检索员工表中,last_name第三个字母为’b’的员工信息。

SELECT e.* FROM employees e WHERE last_name LIKE '%__b%';

(11)检索产品表中,价格介于20元和30元之间的产品的编号、名称和描述信息。

SELECT p.product_id AS '编号',p.name AS '名称',p.description AS '描述信息' FROM products p WHERE price BETWEEN 20 AND 30;

(12)检索员工表中,没有上司的员工的编号、姓名。

SELECT e.employee_id AS '编号',CONCAT (e.first_name,e.last_name) AS '姓名' FROM employees e WHERE manager_id IS NULL;

(13)检索员工表中,工资小于等于500000并且first_name以’F’开头的员工信息

SELECT e.* FROM employees e WHERE SALARY <=500000 AND first_name LIKE 'F%';

1、检索顾客表中:顾客编号、姓名、出生日期。如果出生日期为NULL,则输出1970-01-01。

SELECT c.customer_id,CONCAT(c.first_name,c.last_name),IFNULL (dob,'1970-01-01') dob FROM customers c;

2、检索产品表,输出产品编号,产品名,类型编号,类型名,价格。

SELECT p.product_id,p.name,p.product_type_id,p.description,p.price FROM products p;

3、查询purchases表,统计每个产品被多少个顾客订购,共订购了多少件。

SELECT p.product_id,SUM(product_id) AS '订购数' FROM purchases p GROUP BY p.product_id;

4、查询purchases表,统计每个顾客,共购买了多少次商品,总共订购了多少件。

SELECT p.customer_id,SUM(customer_id) AS '购买商品次数' FROM purchases p GROUP BY
p.customer_id;

5、查询产品表,按产品类型对产品分组,并计算每组产品中的最高价格、最低价格以及平均价格。

SELECT p.product_type_id,MAX(price) AS '最高价',MIN(price) AS '最低价',AVG(price) AS '平均价' FROM products p GROUP BY p.product_type_id;

复杂连接查询

  • 1、检索产品表中,每个产品的编号、名称以及所属类型的编号和名称
-- 1、检索产品表中,每个产品的编号、名称以及所属类型的编号和名称。
SELECT p.`product_id`,p.`name`,t.`product_type_id`,t.`name`
FROM products p,product_types t
WHERE p.`product_type_id` = t.`product_type_id`;

方式二

SELECT p.`product_id`,p.`name`,t.`product_type_id`,t.`name`
FROM products p
JOIN product_types t
ON p.`product_type_id` = t.`product_type_id`;
  • 2、检索员工表中,每个员工的编号、姓名以及他的上司的编号、姓名,没有上司就输出空。
SELECT e1.`employee_id`,CONCAT(e1.`first_name`,e1.`last_name`),e2.`manager_id`,CONCAT(e2.`first_name`,e2.`last_name`)
FROM employees e1
LEFT JOIN employees e2
ON e1.`manager_id` = e2.`employee_id`;
  • 3、检索每个产品的购买信息,包括:产品编号、名称、订购者编号、名称、订购数量。没有被购买过的产品也要输出。
SELECT p.`product_id`,p.`name`,c.`customer_id`,CONCAT(c.`first_name`,c.`last_name`) AS '名称',r.quantity
FROM products p
LEFT JOIN purchases r
ON p.`product_id` = r.`product_id`
LEFT JOIN customers c
ON r.`customer_id` = c.`customer_id`;
  • 4、检索顾客表中,出生日期为NULL的顾客的编号、姓名和电话。
SELECT c.`customer_id`,CONCAT(c.`first_name`,c.`last_name`) AS '姓名',c.`phone`
FROM customers c
WHERE c.`phone` IS NULL;

– 子查询

1、基于products表,查询其价格是同类产品中价格最高或者是最低的产品的编号、产品名称。

SELECT p.`product_id` AS "MAX_id",p.`name` AS "MAX_name"
FROM products p
WHERE price IN (SELECT MAX(price) FROM products GROUP BY product_type_id);

2、基于employees表,查询手下没有下级的员工编号、姓名。

SELECT e1.`employee_id` AS "员工编号",CONCAT(e1.`first_name`,e1.`last_name`) AS "姓名"
FROM employees e1
WHERE NOT EXISTS(SELECT 1 FROM employees e2 WHERE e1.`employee_id` = e2.`manager_id`);

3、基于employees表,查询手下员工超过两名的管理人员的编号和姓名。

SELECT e1.`employee_id`,CONCAT(e1.`first_name`,e1.`last_name`)AS "姓名"
FROM employees e1
WHERE EXISTS (SELECT COUNT(1) FROM employees e2 WHERE e2.`manager_id` = e1.`employee_id` GROUP BY e2.`manager_id` HAVING COUNT(1)>=2);

好了!今天的内容就分享到这了。后面会继续更新Mysql的面试题哦!!!


你可能感兴趣的:(粤嵌打卡第27天(Mysql数据库面试习题------查询))