Exemplo n.º 1
0
def create_actors_table():

    query = """CREATE TABLE IF NOT EXIST actors(
                    actor_id INTEGER PRIMARY KEY AUTOINCREMENT,
                    actor_name TEXT)
                 """
    create_table_database(query)
Exemplo n.º 2
0
def create_studio_table():

    query = """CREATE TABLE IF NOT EXIST studio(
                    studio_id INTEGER PRIMARY KEY AUTOINCREMENT,
                    studio_name TEXT)
                 """
    create_table_database(query)
Exemplo n.º 3
0
def create_genres_table():

        query = """CREATE TABLE IF NOT EXIST genres(
                    genre_id INTEGER PRIMARY KEY AUTOINCREMENT,
                    genre_title TEXT)
                 """
        create_table_database(query)
Exemplo n.º 4
0
def create_directors_movies_table():

        query = """CREATE TABLE IF NOT EXIST directors_movies(
                                directors_movies_id INTEGER PRIMARY KEY AUTOINCREMENT,
                                directors_id  FOREIGN KEY (directors_id) REFERENCES actors(directors_id),
                                movies_id FOREIGN KEY (movies_id) REFERENCES movies(movies_id)))"""
        create_table_database(query)
Exemplo n.º 5
0
def create_movies_table():

    query = """CREATE TABLE IF NOT EXISTS movies(
                    movie_id INTEGER PRIMARY KEY AUTOINCREMENT,
                    movie_title TEXT UNIQUE,
                    movie_director TEXT,
                    release_date DATE,
                    rating REAL,
                    genre TEXT,
                    box_office_id INTEGER,
                    studio_id INTEGER,
                    FOREIGN KEY (box_office_id) REFERENCES box_offices(box_office_id)
                    FOREIGN KEY (studio_id) REFERENCES box_offices(studio_id))"""
    create_table_database(query)
Exemplo n.º 6
0
              movie.box_office_id, movie.studio_id)
    query_database(query, params)


def get_movies():
    query = "SELECT * FROM movies"
    query_database(query)


def update_movies(movie):
    query = "UPDATE movies SET movie_title = ? WHERE movie_id = ?"
    params = (movie.movie_title, movie.movie_id)
    query_database(query, params)


def delete_movies(movie_id):
    query = "DELETE FROM movies WHERE movie_id = ?"
    params = (movie_id)
    query_database(query, params)


# query_database("PRAGMA table_info(movies)")
create_movies_table()
create_table_database("DROP TABLE movies")
movie1 = movie(None, "Pirmas Filmas", "John Dust", 2012, 8.5, "Drama", 1, 1)
movie2 = movie(None, "Antras Filmas", "Chul Lee", 2015, 5.6, "Comedy", 2, 2)
create_movies(movie2)
movie3 = movie(None, "Trecias Filmas", "Peter Loop", 2019, 7.7, "Fantastic", 2,
               1)
# update_movies(movie3)
# get_movies()
Exemplo n.º 7
0
def create_box_offices_table():
    query = """CREATE TABLE IF NOT EXISTS box_office (
                        box_office_id INTEGER PRIMARY KEY AUTOINCREMENT,
                        sales REAl)"""
    create_table_database(query)