diff options
| author | mo khan <mo@mokhan.ca> | 2025-01-13 17:22:18 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-01-13 17:22:18 -0700 |
| commit | 2afd4944c5d1c089a816d009755e0267fd3215cf (patch) | |
| tree | cec879c1770500fbbc1d60f7962c9537865303ef /projects/3/structure.sql | |
| parent | 49053acb0649598c148c91d63938f2b9fefe38da (diff) | |
Work on project 3
Diffstat (limited to 'projects/3/structure.sql')
| -rw-r--r-- | projects/3/structure.sql | 52 |
1 files changed, 47 insertions, 5 deletions
diff --git a/projects/3/structure.sql b/projects/3/structure.sql index 6017494..9bf9e59 100644 --- a/projects/3/structure.sql +++ b/projects/3/structure.sql @@ -1,22 +1,64 @@ create table customers( id integer primary key asc, - first_name varchar(255), - last_name varchar(255), + first_name varchar(255) not null, + last_name varchar(255) not null, + address text, created_at datetime default current_timestamp, updated_at datetime default current_timestamp ); create table categories( - id integer primary key asc + id integer primary key asc, + title varchar(16) unique not null, + description varchar(255) not null, + created_at datetime default current_timestamp, + updated_at datetime default current_timestamp ); create table media( - id integer primary key asc + id integer primary key asc, + title varchar(255) unique not null, + category_id integer not null, + created_at datetime default current_timestamp, + updated_at datetime default current_timestamp, + foreign key(category_id) references categories(id) ); create table rentals( - id integer primary key asc + id integer primary key asc, + rented_at datetime not null, + due_at datetime not null, + created_at datetime default current_timestamp, + updated_at datetime default current_timestamp ); .schema + +insert into customers(first_name, last_name) values('Achilleas', 'Pipinellis'); +insert into customers(first_name, last_name) values('Jessie', 'Young'); +insert into customers(first_name, last_name) values('Laura', 'Montemayor'); +insert into customers(first_name, last_name) values('Michał', 'Zając'); +insert into customers(first_name, last_name) values('Rahul', 'Chanila'); +insert into customers(first_name, last_name) values('Segolene', 'Bouly'); +insert into customers(first_name, last_name) values('Shinya', 'Maeda'); +insert into customers(first_name, last_name) values('Taras', 'Tadai'); +insert into customers(first_name, last_name) values('Tiffany', 'Rea'); +insert into customers(first_name, last_name) values('Vijay', 'Hawoldar'); + +select * from customers; + +-- insert 3 categories +insert into categories(title, description) values('Action', 'A film genre that predominantly features chase sequences, fights, shootouts, explosions, and stunt work'); +insert into categories(title, description) values('Comedy', 'A film genre that emphasizes humor'); +insert into categories(title, description) values('Documentary', 'A film genre that is a non-fictional motion picture intended to document reality, primarily for instruction, education or maintaining a historical record'); +insert into categories(title, description) values('Horror', 'A film genre that seeks to elicit fear or disgust in its audience for entertainment purposes'); + +select * from categories; + +-- insert 30 media +-- insert into media(title, description) values('Action', 'A film genre that predominantly features chase sequences, fights, shootouts, explosions, and stunt work'); + +-- insert 20 rentals + .quit + |
