-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb.sql
More file actions
23 lines (21 loc) · 668 Bytes
/
db.sql
File metadata and controls
23 lines (21 loc) · 668 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
CREATE DATABASE IF NOT EXISTS python_notes;
use python_notes;
CREATE TABLE users(
id int(25) auto_increment not null,
name varchar(100),
surnames varchar(255),
email varchar(255) not null,
password varchar(255) not null,
fecha date not null,
CONSTRAINT pk_users PRIMARY KEY (id),
CONSTRAINT uq_email UNIQUE(email)
)ENGINE=InnoDb;
CREATE TABLE notes(
id int(25) auto_increment not null,
user_id int(25) not null,
title varchar(255) not null,
description MEDIUMTEXT,
date date not null,
CONSTRAINT pk_notes PRIMARY KEY(id),
CONSTRAINT fk_user_note FOREIGN KEY (user_id) REFERENCES users(id)
)ENGINE=InnoDb;