CREATE TABLE film_text
(
    film_id     INTEGER     not null
        primary key,
    title       TEXT not null,
    description TEXT         null
);
film_text
CREATE TABLE "actor"
(
    actor_id    INTEGER
        primary key autoincrement,
    first_name  TEXT                               not null,
    last_name   TEXT                               not null,
    last_update DATETIME default CURRENT_TIMESTAMP not null
);
actor
CREATE TABLE "address"
(
    address_id  INTEGER
        primary key autoincrement,
    address     TEXT                               not null,
    address2    TEXT,
    district    TEXT                               not null,
    city_id     INTEGER                            not null
        references city
            on update cascade,
    postal_code TEXT,
    phone       TEXT                               not null,
    last_update DATETIME default CURRENT_TIMESTAMP not null
);
address
CREATE TABLE "category"
(
    category_id INTEGER
        primary key autoincrement,
    name        TEXT                               not null,
    last_update DATETIME default CURRENT_TIMESTAMP not null
);
category
CREATE TABLE "city"
(
    city_id     INTEGER
        primary key autoincrement,
    city        TEXT                               not null,
    country_id  INTEGER                            not null
        references country
            on update cascade,
    last_update DATETIME default CURRENT_TIMESTAMP not null
);
city
CREATE TABLE "country"
(
    country_id  INTEGER
        primary key autoincrement,
    country     TEXT                               not null,
    last_update DATETIME default CURRENT_TIMESTAMP not null
);
country
CREATE TABLE "customer"
(
    customer_id INTEGER
        primary key autoincrement,
    store_id    INTEGER                            not null
        references store
            on update cascade,
    first_name  TEXT                               not null,
    last_name   TEXT                               not null,
    email       TEXT,
    address_id  INTEGER                            not null
        references address
            on update cascade,
    active      INTEGER  default 1                 not null,
    create_date DATETIME                           not null,
    last_update DATETIME default CURRENT_TIMESTAMP not null
);
customer
CREATE TABLE "film"
(
    film_id              INTEGER
        primary key autoincrement,
    title                TEXT                               not null,
    description          TEXT,
    release_year         TEXT,
    language_id          INTEGER                            not null
        references language
            on update cascade,
    original_language_id INTEGER
        references language
            on update cascade,
    rental_duration      INTEGER  default 3                 not null,
    rental_rate          REAL     default 4.99              not null,
    length               INTEGER,
    replacement_cost     REAL     default 19.99             not null,
    rating               TEXT     default 'G',
    special_features     TEXT,
    last_update          DATETIME default CURRENT_TIMESTAMP not null
);
film
CREATE TABLE "film_actor"
(
    actor_id    INTEGER                            not null
        references actor
            on update cascade,
    film_id     INTEGER                            not null
        references film
            on update cascade,
    last_update DATETIME default CURRENT_TIMESTAMP not null,
    primary key (actor_id, film_id)
);
film_actor
CREATE TABLE "film_category"
(
    film_id     INTEGER                            not null
        references film
            on update cascade,
    category_id INTEGER                            not null
        references category
            on update cascade,
    last_update DATETIME default CURRENT_TIMESTAMP not null,
    primary key (film_id, category_id)
);
film_category
CREATE TABLE "inventory"
(
    inventory_id INTEGER
        primary key autoincrement,
    film_id      INTEGER                            not null
        references film
            on update cascade,
    store_id     INTEGER                            not null
        references store
            on update cascade,
    last_update  DATETIME default CURRENT_TIMESTAMP not null
);
inventory
CREATE TABLE "language"
(
    language_id INTEGER
        primary key autoincrement,
    name        TEXT                               not null,
    last_update DATETIME default CURRENT_TIMESTAMP not null
);
language
CREATE TABLE "payment"
(
    payment_id   INTEGER
        primary key autoincrement,
    customer_id  INTEGER                            not null
        references customer
            on update cascade,
    staff_id     INTEGER                            not null
        references staff
            on update cascade,
    rental_id    INTEGER
                                                    references rental
                                                        on update cascade on delete set null,
    amount       REAL                               not null,
    payment_date DATETIME                           not null,
    last_update  DATETIME default CURRENT_TIMESTAMP not null
);
payment
CREATE TABLE "rental"
(
    rental_id    INTEGER
        primary key autoincrement,
    rental_date  DATETIME                           not null,
    inventory_id INTEGER                            not null
        references inventory
            on update cascade,
    customer_id  INTEGER                            not null
        references customer
            on update cascade,
    return_date  DATETIME,
    staff_id     INTEGER                            not null
        references staff
            on update cascade,
    last_update  DATETIME default CURRENT_TIMESTAMP not null,
    unique (rental_date, inventory_id, customer_id)
);
rental
CREATE TABLE "staff"
(
    staff_id    INTEGER
        primary key autoincrement,
    first_name  TEXT                               not null,
    last_name   TEXT                               not null,
    address_id  INTEGER                            not null
        references address
            on update cascade,
    picture     BLOB,
    email       TEXT,
    store_id    INTEGER                            not null
        references store
            on update cascade,
    active      INTEGER  default 1                 not null,
    username    TEXT                               not null,
    password    TEXT,
    last_update DATETIME default CURRENT_TIMESTAMP not null
);
staff
CREATE TABLE "store"
(
    store_id         INTEGER
        primary key autoincrement,
    manager_staff_id INTEGER                            not null
        unique
        references staff
            on update cascade,
    address_id       INTEGER                            not null
        references address
            on update cascade,
    last_update      DATETIME default CURRENT_TIMESTAMP not null
);
store
original_column_name,column_name,column_description,data_format,value_description
film_id,film id,unique id number identifying the film,integer,
title,title,title of the film,text,
description,description,main content of the film,text,
film_text
original_column_name,column_name,column_description,data_format,value_description
customer_id,country id,unique id number identifying the country,integer,
store_id,store id,unique id number identifying the store,integer,
first_name,first name,First name of the customer,text,
last_name,last name,Last name of the customer,text,
email,,Email address of the customer,text,
address_id,address id,Address id number of the customer.,integer ,
active,,Wether the customer is active or not.,integer,"1: active
0: not active"
create_date,create date,The date when the record is created.,datetime,
last_update,last update,The time of the latest update,datetime,
customer
original_column_name,column_name,column_description,data_format,value_description
language_id,language id,unique id number identifying the language,integer ,
name,name,name of the language,text,
last_update,last update,The time of the latest update,datetime,
language
original_column_name,column_name,column_description,data_format,value_description
category_id,category id,unique id number identifying the category,integer ,
name,,name of the category,text,
last_update,last update,The time of the latest update,datetime,
category
original_column_name,column_name,column_description,data_format,value_description
actor_id,actor id,unique id number identifying the actor,integer ,
film_id,film id,id number identifying the film,integer ,
last_update,last update,The time of the latest update,datetime,
film_actor
original_column_name,column_name,column_description,data_format,value_description
address_id,address id,unique id number identifying the address,integer ,
address,,The first address line,text,
address2,address 2,the second address line,text,"commonsense evidence:
address2 is the additional address if any"
district,,,text,
city_id,,,integer unsigned,
postal_code,postal code,,text,"a postal code is a series of letters or digits or both, sometimes including spaces or punctuation, included in a postal address for the purpose of sorting mail."
phone,,phone number,text,
last_update,last update,The time of the latest update,datetime,
address
original_column_name,column_name,column_description,data_format,value_description
city_id,city id,unique id number identifying the city,integer ,
city,,name of the city,text,
country_id,country id,number identifying the country which the city belongs to,integer ,
last_update,last update,The time of the latest update,datetime,
city
original_column_name,column_name,column_description,data_format,value_description
inventory_id,inventory id,unique id number identifying the inventory,integer ,
film_id,film id,unique id number identifying the film,integer ,
store_id,store id, id of the store,integer,
last_update,last update,the last update time of the film,datetime,
inventory
original_column_name,column_name,column_description,data_format,value_description
film_id,film id,unique id number identifying the film,integer,
category_id,category id,id number identifying the category,integer,
last_update,last update,The time of the latest update,datetime,
film_category
original_column_name,column_name,column_description,data_format,value_description
payment_id,payment id,unique id number identifying the payment,integer ,
customer_id,customer id,unique id number identifying the customer,integer ,
staff_id,staff id,unique id number identifying the staff,integer ,
rental_id,rental id,unique id number identifying the rental,integer,
amount,amount,unique id number identifying the amount,real,
payment_date,payment date,the date when the payment ocurs,datetime,
last_update,last update,The time of the latest update,datetime,
payment
original_column_name,column_name,column_description,data_format,value_description
store_id,store id,unique id number identifying the store,integer ,
manager_staff_id,manager staff id,id number identifying the manager staff,integer ,
address_id,address id,id number identifying the address,integer ,
last_update,last update,The time of the latest update,datetime,
store
original_column_name,column_name,column_description,data_format,value_description
country_id,country id,unique id number identifying the country,integer ,
country,the name of the country,number identifying the country,text,"commonsense evidence:
 Africa: (Algeria, Angola, Cameroon, Chad, Congo, The Democratic Republic of the, Egypt, Ethiopia, Gambia...)
 Asia: (Afghanistan, Armenia, Azerbaijan, 
Bahrain, Bangladesh, Brunei, Cambodia, China, Hong Kong, India, Indonesia, Iran, Iraq, Israel...)
 Oceania (American Samoa, Australia, French Polynesia...)
 North America (Anguilla, Canada, Dominican Republic, Ecuador, Greenland...)
 South America (Argentina, Bolivia, Brazil, Chile, 
Colombia, Ecuador, French Guiana....)
 Europe (Austria, Belarus, Bulgaria, Czech Republic, Estonia, Faroe Islands, Finland, France, Germany, Greece, Holy See (Vatican City State), Hungary, Italy...)
details: https://worldpopulationreview.com/country-rankings/list-of-countries-by-continent
question can mention i.e., Europe instead of Austria, etc."
last_update,last update,The time of the latest update,datetime,
country
original_column_name,column_name,column_description,data_format,value_description
staff_id,staff id,unique id number identifying the staff,integer ,
first_name,first name,First name of the actor,text,
last_name,last name,Last name of the actor,text,"full name = (first name, last name)"
address_id,address id,id number identifying the address,integer,
picture,picture of the staff,,blob,
email,email of the staff,,text,
store_id,store id,id number identifying the store,integer ,
active,,Whether the staff is active or not.,integer,"1: active
0: not active"
username,,username to login the staff,text,
password,,password to login the staff,text,
last_update,last update,The time of the latest update,datetime,
staff
original_column_name,column_name,column_description,data_format,value_description
film_id,film id,unique id number identifying the film,integer ,
title,title,title of the film,text,
description,description,main content of the film,text,
release_year,release year,the year when the film is released,text,
language_id,language id,the language id of the film,integer ,
original_language_id,original language id,the original language id of the film,integer ,
rental_duration,rental duration,how long this film can be rent at once,integer,"commonsense evidence:
days
price / day = rental_rate / retal_duration"
rental_rate,rental rate,the rate of renting this film,real,higher -> expensive
length,length,Duration time of the film screening,integer,minutes
replacement_cost,replacement cost,cost of replacing this film,real,
rating,rating,The Motion Picture Association film rating,text,"commonsense evidence:
G ?General Audiences
PG ? Parental Guidance Suggested
PG-13 ? Parents Strongly Cautioned
R ? Restricted
NC-17 ? Adults Only"
special_features,special features,features of this film,text,
last_update,last update,The time of the latest update,datetime,
film
original_column_name,column_name,column_description,data_format,value_description
rental_id,rental id,unique id number identifying the rental,integer ,
rental_date,rental date,date when the rental occurs,datetime,
inventory_id,inventory id,id number identifying the inventory,integer ,
customer_id,customer id,id number identifying the customer,integer ,
return_date,return date,date when the rental returns,datetime,
staff_id,staff id,id number identifying the staff,integer ,
last_update,last update,The time of the latest update,datetime,
rental
original_column_name,column_name,column_description,data_format,value_description
actor_id,actor id,unique id number identifying the actor,integer ,
first_name,first name,First name of the actor,text,
last_name,last name,Last name of the actor,text,
last_update,last update,The time of the latest update,datetime,
actor