Thứ Bảy, 20 tháng 2, 2021

Dữ liệu mẫu thực hành SQL: Bảng PRODUCTS, CUSTOMERS, CHANNELS, PROMOTIONS, và SALES

Mục đích: Dữ liệu mẫu thực hành SQL: Bảng PRODUCTS, CUSTOMERS, CHANNELS, PROMOTIONS, và SALES 

Tóm tắt:
products /insert 10
   name vc50
   description
   sku vc30
   unit num
   unit price num

customers /insert 20
   first name
   last name
   email
   city
   country vc50
   gender  vc30 /check Male, Female
   date of birth
   phone vc30
   postal code vc30

channels /insert 3
   name /check direct, online, phone

promotions /insert 4
   name
   code vc10
   date begin
   date end
   discount percentage  num

sales /insert 40
   product id
   customer id
   promotion id
   channel id
   date of sale
   quantity num
   unit price num

view sales_v products customers channels promotions sales

CHI TIẾT
 
-- create tables
create table products (
    name                           varchar2(50),
    description                    varchar2(4000),
    sku                            varchar2(30),
    unit                           number,
    unit_price                     number
)
;

create table customers (
    first_name                     varchar2(255),
    last_name                      varchar2(255),
    email                          varchar2(255),
    city                           varchar2(255),
    country                        varchar2(50),
    gender                         varchar2(30) constraint customers_gender_cc
                                   check (gender in ('MALE','FEMALE')),
    date_of_birth                  date,
    phone                          varchar2(30),
    postal_code                    varchar2(30)
)
;

create table channels (
    name                           varchar2(255) constraint channels_name_cc
                                   check (name in ('DIRECT','ONLINE','PHONE'))
)
;

create table promotions (
    name                           varchar2(255),
    code                           varchar2(10),
    date_begin                     date,
    date_end                       date,
    discount_percentage            number
)
;

create table sales (
    product_id                     number
                                   constraint sales_product_id_fk
                                   references products on delete cascade,
    customer_id                    number
                                   constraint sales_customer_id_fk
                                   references customers on delete cascade,
    promotion_id                   number
                                   constraint sales_promotion_id_fk
                                   references promotions on delete cascade,
    channel_id                     number
                                   constraint sales_channel_id_fk
                                   references channels on delete cascade,
    date_of_sale                   date,
    quantity                       number,
    unit_price                     number
)
;


-- triggers
create or replace trigger channels_biu
    before insert or update 
    on channels
    for each row
begin
    null;
end channels_biu;
/

create or replace trigger customers_biu
    before insert or update 
    on customers
    for each row
begin
    null;
end customers_biu;
/

create or replace trigger products_biu
    before insert or update 
    on products
    for each row
begin
    null;
end products_biu;
/

create or replace trigger promotions_biu
    before insert or update 
    on promotions
    for each row
begin
    null;
end promotions_biu;
/

create or replace trigger sales_biu
    before insert or update 
    on sales
    for each row
begin
    null;
end sales_biu;
/


-- indexes
create index sales_i1 on sales (channel_id);
create index sales_i2 on sales (customer_id);
create index sales_i3 on sales (product_id);
create index sales_i4 on sales (promotion_id);

-- create views
create or replace view sales_v as 
select 
    products.name                                      product_name,
    products.description                               description,
    products.sku                                       sku,
    products.unit                                      unit,
    products.unit_price                                product_unit_price,
    customers.first_name                               first_name,
    customers.last_name                                last_name,
    customers.email                                    email,
    customers.city                                     city,
    customers.country                                  country,
    customers.gender                                   gender,
    customers.date_of_birth                            date_of_birth,
    customers.phone                                    phone,
    customers.postal_code                              postal_code,
    channels.name                                      channel_name,
    promotions.name                                    promotion_name,
    promotions.code                                    code,
    promotions.date_begin                              date_begin,
    promotions.date_end                                date_end,
    promotions.discount_percentage                     discount_percentage,
    sales.date_of_sale                                 date_of_sale,
    sales.quantity                                     quantity,
    sales.unit_price                                   sale_unit_price
from 
    products,
    customers,
    channels,
    promotions,
    sales
where
    sales.product_id(+) = products.id and
    sales.customer_id(+) = customers.id and
    sales.promotion_id(+) = promotions.id and
    sales.channel_id(+) = channels.id
/

-- load data
 
insert into products (
    name,
    description,
    sku,
    unit,
    unit_price
) values (
    'M-AABV-47',
    'Fames ac ante ipsum primis in faucibus. Ut id nulla ac sapien suscipit tristique ac volutpat risus.Phasellus vitae ligula commodo, dictum lorem sit amet, imperdiet ex. Etiam cursus porttitor tincidunt. Vestibulum ante ipsumprimis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin vulputate placerat pellentesque. Proin viverra lacinialectus, quis consectetur mi venenatis nec. Donec convallis sollicitudin elementum. Nulla facilisi. In posuere blandit leoeget malesuada. Vivamus efficitur ipsum tellus, quis posuere mi maximus vitae. Quisque tortor odio, feugiat eget sagittisvel, pretium ut metus. Duis et.',
    'Lectus Nulla Placerat',
    32,
    30
);

insert into products (
    name,
    description,
    sku,
    unit,
    unit_price
) values (
    'M-AACT-71',
    'Cursus porttitor tincidunt. Vestibulum ante ipsumprimis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin vulputate placerat pellentesque. Proin viverra lacinialectus, quis consectetur mi venenatis nec. Donec convallis sollicitudin elementum. Nulla facilisi. In posuere blandit leoeget malesuada. Vivamus efficitur ipsum tellus, quis posuere mi maximus vitae. Quisque tortor odio, feugiat eget sagittisvel, pretium ut metus. Duis et commodo arcu, in vestibulum tellus. In sollicitudin nisi mi, pharetra gravida ex semper ut.Donec nibh sapien, hendrerit quis varius eget, malesuada vitae turpis. Lorem ipsum dolor sit.',
    'Mattis Risus Rhoncuscras',
    20,
    93
);

insert into products (
    name,
    description,
    sku,
    unit,
    unit_price
) values (
    'M-AADE-82',
    'Id nulla ac sapien suscipit tristique ac volutpat risus.Phasellus vitae ligula commodo, dictum lorem sit amet, imperdiet ex. Etiam cursus porttitor tincidunt. Vestibulum ante ipsumprimis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin vulputate placerat pellentesque. Proin viverra lacinialectus, quis consectetur mi venenatis nec. Donec convallis sollicitudin elementum. Nulla facilisi. In posuere blandit leoeget malesuada. Vivamus efficitur ipsum tellus, quis posuere mi maximus vitae. Quisque tortor odio, feugiat eget sagittisvel, pretium ut metus. Duis et commodo arcu, in vestibulum tellus. In sollicitudin nisi mi, pharetra gravida ex semper ut.Donec nibh sapien, hendrerit quis varius eget,.',
    'Nam Semper Diam',
    65,
    98
);

insert into products (
    name,
    description,
    sku,
    unit,
    unit_price
) values (
    'M-AAD1-98',
    'Orci luctus et ultrices posuere cubilia Curae; Proin vulputate placerat pellentesque. Proin viverra lacinialectus, quis consectetur mi venenatis nec. Donec convallis sollicitudin elementum. Nulla facilisi. In posuere blandit leoeget malesuada. Vivamus efficitur ipsum tellus, quis posuere mi maximus vitae. Quisque tortor odio, feugiat eget sagittisvel, pretium ut metus. Duis et commodo arcu, in vestibulum tellus. In sollicitudin.',
    'Tincidunt Vestibulum Ante',
    66,
    34
);

insert into products (
    name,
    description,
    sku,
    unit,
    unit_price
) values (
    'M-AADA-78',
    'Ac sapien suscipit tristique ac volutpat risus.Phasellus vitae ligula commodo, dictum lorem sit amet, imperdiet ex. Etiam cursus porttitor tincidunt. Vestibulum ante ipsumprimis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin vulputate placerat pellentesque. Proin viverra lacinialectus, quis consectetur mi venenatis nec. Donec convallis sollicitudin elementum. Nulla facilisi. In posuere blandit leoeget malesuada. Vivamus efficitur ipsum tellus, quis posuere mi maximus vitae. Quisque tortor odio, feugiat eget sagittisvel, pretium ut metus. Duis et commodo arcu, in vestibulum tellus. In sollicitudin nisi mi, pharetra gravida ex semper ut.Donec nibh sapien, hendrerit quis varius.',
    'Id Mattis Risus',
    91,
    60
);

insert into products (
    name,
    description,
    sku,
    unit,
    unit_price
) values (
    'M-AADG-84',
    'Ac volutpat risus.Phasellus vitae ligula commodo, dictum lorem sit amet, imperdiet ex. Etiam cursus porttitor tincidunt. Vestibulum ante ipsumprimis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin vulputate placerat.',
    'Ac Ante Ipsum',
    5,
    37
);

insert into products (
    name,
    description,
    sku,
    unit,
    unit_price
) values (
    'M-AACX-75',
    'Sit amet massa eu lorem commodo ullamcorper.Interdum et malesuada fames ac ante ipsum primis in faucibus. Ut id nulla ac sapien suscipit tristique ac volutpat risus.Phasellus vitae ligula commodo, dictum lorem sit amet, imperdiet ex.',
    'Posuere Cubilia Curae;',
    28,
    89
);

insert into products (
    name,
    description,
    sku,
    unit,
    unit_price
) values (
    'M-AABL-37',
    'Volutpat risus.Phasellus vitae ligula commodo, dictum lorem sit amet, imperdiet ex. Etiam cursus porttitor tincidunt. Vestibulum ante ipsumprimis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin vulputate placerat pellentesque. Proin viverra lacinialectus, quis consectetur mi venenatis nec. Donec.',
    'Lorem Commodo Ullamcorperinter',
    71,
    17
);

insert into products (
    name,
    description,
    sku,
    unit,
    unit_price
) values (
    'M-AADC-80',
    'Id nulla ac sapien suscipit tristique ac volutpat risus.Phasellus vitae ligula commodo, dictum lorem sit amet, imperdiet ex. Etiam cursus porttitor tincidunt. Vestibulum ante ipsumprimis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin vulputate placerat pellentesque. Proin viverra lacinialectus, quis consectetur mi venenatis nec. Donec convallis sollicitudin elementum. Nulla facilisi. In posuere blandit leoeget malesuada. Vivamus efficitur ipsum tellus, quis posuere mi maximus vitae. Quisque tortor odio, feugiat eget sagittisvel, pretium ut metus. Duis et commodo arcu, in vestibulum tellus. In sollicitudin nisi mi, pharetra gravida ex semper ut.Donec nibh sapien, hendrerit quis varius eget,.',
    'Lectus Nulla Placerat',
    23,
    82
);

insert into products (
    name,
    description,
    sku,
    unit,
    unit_price
) values (
    'M-AABQ-42',
    'Elementum sodales. Proin sit amet massa eu lorem commodo ullamcorper.Interdum et malesuada fames ac ante ipsum primis in faucibus. Ut id nulla ac sapien suscipit tristique ac volutpat risus.Phasellus vitae ligula commodo, dictum lorem sit amet, imperdiet ex. Etiam cursus porttitor tincidunt. Vestibulum ante ipsumprimis in faucibus orci luctus et.',
    'Risusphasellus Vitae Ligula',
    90,
    21
);

commit;
-- load data
 
insert into customers (
    first_name,
    last_name,
    email,
    city,
    country,
    gender,
    date_of_birth,
    phone,
    postal_code
) values (
    'Gricelda',
    'Luebbers',
    'gricelda.luebbers@aaab.com',
    'Tanquecitos',
    'United States',
    'MALE',
    sysdate - 98,
    'Lacinialectus Quis Consectetur',
    'Consectetur Mi Venenatis'
);

insert into customers (
    first_name,
    last_name,
    email,
    city,
    country,
    gender,
    date_of_birth,
    phone,
    postal_code
) values (
    'Dean',
    'Bollich',
    'dean.bollich@aaac.com',
    'Sugarloaf',
    'United States',
    'FEMALE',
    sysdate - 42,
    'Amet Imperdiet Ex',
    'Diam Suscipit Elementum'
);

insert into customers (
    first_name,
    last_name,
    email,
    city,
    country,
    gender,
    date_of_birth,
    phone,
    postal_code
) values (
    'Milo',
    'Manoni',
    'milo.manoni@aaad.com',
    'Dale City',
    'United States',
    'MALE',
    sysdate - 69,
    'Eget Rhoncus Nonmolestie',
    'Ex Etiam Cursus'
);

insert into customers (
    first_name,
    last_name,
    email,
    city,
    country,
    gender,
    date_of_birth,
    phone,
    postal_code
) values (
    'Laurice',
    'Karl',
    'laurice.karl@aaae.com',
    'Grosvenor',
    'United States',
    'FEMALE',
    sysdate - 85,
    'Et Malesuada Fames',
    'Sodales Proin Sit'
);

insert into customers (
    first_name,
    last_name,
    email,
    city,
    country,
    gender,
    date_of_birth,
    phone,
    postal_code
) values (
    'August',
    'Rupel',
    'august.rupel@aaaf.com',
    'Riverside',
    'United States',
    'MALE',
    sysdate - 28,
    'Lacinia Arcu In',
    'Sollicitudin Elementum Nulla'
);

insert into customers (
    first_name,
    last_name,
    email,
    city,
    country,
    gender,
    date_of_birth,
    phone,
    postal_code
) values (
    'Salome',
    'Guisti',
    'salome.guisti@aaag.com',
    'Ridgeley',
    'United States',
    'FEMALE',
    sysdate - 46,
    'Iaculis Aliquam Vestibulum',
    'Suscipit Tristique Ac'
);

insert into customers (
    first_name,
    last_name,
    email,
    city,
    country,
    gender,
    date_of_birth,
    phone,
    postal_code
) values (
    'Lovie',
    'Ritacco',
    'lovie.ritacco@aaah.com',
    'Ashley Heights',
    'United States',
    'MALE',
    sysdate - 75,
    'Tristique Ac Volutpat',
    'Nam Semper Diam'
);

insert into customers (
    first_name,
    last_name,
    email,
    city,
    country,
    gender,
    date_of_birth,
    phone,
    postal_code
) values (
    'Chaya',
    'Greczkowski',
    'chaya.greczkowski@aaai.com',
    'Monfort Heights',
    'United States',
    'FEMALE',
    sysdate - 2,
    'Ullamcorperinterdum Et Malesua',
    'Rhoncus Nonmolestie Sit'
);

insert into customers (
    first_name,
    last_name,
    email,
    city,
    country,
    gender,
    date_of_birth,
    phone,
    postal_code
) values (
    'Twila',
    'Coolbeth',
    'twila.coolbeth@aaaj.com',
    'Point Marion',
    'United States',
    'MALE',
    sysdate - 5,
    'Vestibulum Eget Rhoncus',
    'Sit Amet Massa'
);

insert into customers (
    first_name,
    last_name,
    email,
    city,
    country,
    gender,
    date_of_birth,
    phone,
    postal_code
) values (
    'Carlotta',
    'Achenbach',
    'carlotta.achenbach@aaak.com',
    'Eldon',
    'United States',
    'FEMALE',
    sysdate - 27,
    'Sit Amet Massa',
    'Ac Sapien Suscipit'
);

insert into customers (
    first_name,
    last_name,
    email,
    city,
    country,
    gender,
    date_of_birth,
    phone,
    postal_code
) values (
    'Jeraldine',
    'Audet',
    'jeraldine.audet@aaal.com',
    'Greendale',
    'United States',
    'MALE',
    sysdate - 33,
    'Cubilia Curae; Proin',
    'Convallis Sollicitudin Element'
);

insert into customers (
    first_name,
    last_name,
    email,
    city,
    country,
    gender,
    date_of_birth,
    phone,
    postal_code
) values (
    'August',
    'Arouri',
    'august.arouri@aaam.com',
    'Ammon',
    'United States',
    'FEMALE',
    sysdate - 18,
    'Diam Suscipit Elementum',
    'In Massa Pharetra'
);

insert into customers (
    first_name,
    last_name,
    email,
    city,
    country,
    gender,
    date_of_birth,
    phone,
    postal_code
) values (
    'Ward',
    'Stepney',
    'ward.stepney@aaan.com',
    'Wallsburg',
    'United States',
    'MALE',
    sysdate - 72,
    'Lectus Nulla Placerat',
    'Sapien Suscipit Tristique'
);

insert into customers (
    first_name,
    last_name,
    email,
    city,
    country,
    gender,
    date_of_birth,
    phone,
    postal_code
) values (
    'Ayana',
    'Barkhurst',
    'ayana.barkhurst@aaao.com',
    'De Pue',
    'United States',
    'FEMALE',
    sysdate - 19,
    'Tincidunt Vestibulum Ante',
    'Luctus Et Ultrices'
);

insert into customers (
    first_name,
    last_name,
    email,
    city,
    country,
    gender,
    date_of_birth,
    phone,
    postal_code
) values (
    'Luana',
    'Berends',
    'luana.berends@aaap.com',
    'Prompton',
    'United States',
    'MALE',
    sysdate - 63,
    'Lorem Sit Amet',
    'Etiam Cursus Porttitor'
);

insert into customers (
    first_name,
    last_name,
    email,
    city,
    country,
    gender,
    date_of_birth,
    phone,
    postal_code
) values (
    'Lecia',
    'Alvino',
    'lecia.alvino@aaaq.com',
    'New Rockford',
    'United States',
    'FEMALE',
    sysdate - 51,
    'Vestibulum Lacinia Arcu',
    'Vestibulum Lacinia Arcu'
);

insert into customers (
    first_name,
    last_name,
    email,
    city,
    country,
    gender,
    date_of_birth,
    phone,
    postal_code
) values (
    'Joleen',
    'Himmelmann',
    'joleen.himmelmann@aaar.com',
    'Tygh Valley',
    'United States',
    'MALE',
    sysdate - 26,
    'Eu Lorem Commodo',
    'Sollicitudin Elementum Nulla'
);

insert into customers (
    first_name,
    last_name,
    email,
    city,
    country,
    gender,
    date_of_birth,
    phone,
    postal_code
) values (
    'Monty',
    'Kinnamon',
    'monty.kinnamon@aaas.com',
    'Lookout',
    'United States',
    'FEMALE',
    sysdate - 66,
    'Placerat Iaculis Aliquam',
    'Ullamcorperinterdum Et Malesua'
);

insert into customers (
    first_name,
    last_name,
    email,
    city,
    country,
    gender,
    date_of_birth,
    phone,
    postal_code
) values (
    'Dania',
    'Grizzard',
    'dania.grizzard@aaat.com',
    'Hermiston',
    'United States',
    'MALE',
    sysdate - 87,
    'Nonmolestie Sit Amet',
    'Dictum Lorem Sit'
);

insert into customers (
    first_name,
    last_name,
    email,
    city,
    country,
    gender,
    date_of_birth,
    phone,
    postal_code
) values (
    'Inez',
    'Yamnitz',
    'inez.yamnitz@aaau.com',
    'Mendota Heights',
    'United States',
    'FEMALE',
    sysdate - 1,
    'Semper Diam Suscipit',
    'Pharetra Id Mattis'
);

commit;
-- load data
 
insert into channels (
    name
) values (
    'DIRECT'
);

insert into channels (
    name
) values (
    'ONLINE'
);

insert into channels (
    name
) values (
    'PHONE'
);

commit;
-- load data
 
insert into promotions (
    name,
    code,
    date_begin,
    date_end,
    discount_percentage
) values (
    'Mac Prevention',
    'Sapien',
    sysdate - 94,
    sysdate - 92,
    7
);

insert into promotions (
    name,
    code,
    date_begin,
    date_end,
    discount_percentage
) values (
    'Personal Information Security Review',
    'Risus',
    sysdate - 97,
    sysdate - 43,
    91
);

insert into promotions (
    name,
    code,
    date_begin,
    date_end,
    discount_percentage
) values (
    'Employee Automation',
    'Risusphase',
    sysdate - 99,
    sysdate - 12,
    54
);

insert into promotions (
    name,
    code,
    date_begin,
    date_end,
    discount_percentage
) values (
    'Deadlock Detection Review',
    'Ipsumprimi',
    sysdate - 93,
    sysdate - 86,
    22
);

commit;
-- load data
 
insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 16,
    15,
    38
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 9,
    29,
    62
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 35,
    62,
    17
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 11,
    89,
    47
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 27,
    1,
    94
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 90,
    52,
    88
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 71,
    51,
    48
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 47,
    55,
    36
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 66,
    53,
    92
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 39,
    63,
    44
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 75,
    23,
    56
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 53,
    34,
    48
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 43,
    70,
    31
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 65,
    82,
    80
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 55,
    17,
    82
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 54,
    58,
    43
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 6,
    12,
    50
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 30,
    83,
    49
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 64,
    31,
    95
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 54,
    28,
    26
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 59,
    87,
    19
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 85,
    86,
    68
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 42,
    2,
    8
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 9,
    37,
    14
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 4,
    95,
    70
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 72,
    10,
    14
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 83,
    87,
    36
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 95,
    43,
    74
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 93,
    75,
    15
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 83,
    7,
    35
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 66,
    88,
    49
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 43,
    45,
    93
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 5,
    94,
    9
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 56,
    72,
    89
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 20,
    36,
    70
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 44,
    21,
    26
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 71,
    66,
    72
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 86,
    49,
    18
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 41,
    64,
    72
);

insert into sales (
    product_id,
    customer_id,
    promotion_id,
    channel_id,
    date_of_sale,
    quantity,
    unit_price
) values (
    1,
    1,
    1,
    1,
    sysdate - 15,
    88,
    31
);

commit;

=============================
* KHOÁ HỌC ORACLE DATABASE A-Z ENTERPRISE trực tiếp từ tôi giúp bạn bước đầu trở thành những chuyên gia DBA, đủ kinh nghiệm đi thi chứng chỉ OA/OCP, đặc biệt là rất nhiều kinh nghiệm, bí kíp thực chiến trên các hệ thống Core tại VN chỉ sau 1 khoá học.
* CÁCH ĐĂNG KÝ: Gõ (.) hoặc để lại số điện thoại hoặc inbox https://m.me/tranvanbinh.vn hoặc Hotline/Zalo 090.29.12.888
* Chi tiết tham khảo:
https://bit.ly/oaz_w
hoặc
https://bit.ly/oaz_fp
=============================
KẾT NỐI VỚI CHUYÊN GIA TRẦN VĂN BÌNH:
📧 Mail: binhoracle@gmail.com
☎️ Mobile: 0902912888
⚡️ Skype: tranbinh48ca
👨 Facebook: https://www.facebook.com/BinhOracleMaster
👨 Inbox Messenger: https://m.me/101036604657441 (profile)
👨 Fanpage: https://www.facebook.com/tranvanbinh.vn
👨 Inbox Fanpage: https://m.me/tranvanbinh.vn
👨👩 Group FB: https://www.facebook.com/groups/DBAVietNam
👨 Website: https://www.tranvanbinh.vn
👨 Blogger: https://tranvanbinhmaster.blogspot.com
🎬 Youtube: http://bit.ly/ytb_binhoraclemaster
👨 Tiktok: https://www.tiktok.com/@binhoraclemaster?lang=vi
👨 Linkin: https://www.linkedin.com/in/binhoracle
👨 Twitter: https://twitter.com/binhoracle
👨 Địa chỉ: Tòa nhà Sun Square - 21 Lê Đức Thọ - Phường Mỹ Đình 1 - Quận Nam Từ Liêm - TP.Hà Nội

=============================
học oracle database
Các tìm kiếm liên quan đến học oracle
database
Tự học Oracle
Tài liệu Oracle 12c tiếng Việt
Hướng dẫn sử dụng Oracle Database
Oracle SQL cơ bản
Oracle SQL là gì
Khóa học Oracle Hà Nội
Học chứng chỉ Oracle ở đầu
Khóa học Oracle online
khóa học pl/sql
học dba
học dba ở việt nam
khóa học dba
khóa học dba sql
tài liệu học dba oracle
Khóa học Oracle online
học oracle sql
học oracle ở đâu tphcm
học oracle bắt đầu từ đâu
học oracle ở hà nội
oracle database tutorial
oracle database 12c
oracle database là gì
oracle database 11g
oracle download
oracle database 19c
oracle dba tutorial
oracle tunning
sql tunning
oracle 12c
oracle dataguard
oracle goldengate
oracle weblogic
oracle exadata
hoc solaris
hoc linux
hoc aix

ĐỌC NHIỀU

Trần Văn Bình - Oracle Database Master