Crear BD:
https://www.w3schools.com/sql/sql_create_db.asp
Crear tabla:
http://www.mysqltutorial.org/mysql-create-table/
http://www.mysqltutorial.org/mysql-foreign-key/
http://www.mysqltutorial.org/mysql-index/mysql-create-index/
CREATE TABLE [IF NOT EXISTS] table_name( lista_columnas ) ENGINE=storage_engine -- Formato de las columnas: nombre_columna tipo_columna(length) [NOT NULL] [DEFAULT value] [AUTO_INCREMENT] PRIMARY KEY (columna) -- De las dos maneras se puede: INDEX nombre_indice (nombre_columna) KEY (nombre_columna) FOREIGN KEY nombre_clave_foranea(columna) REFERENCES tabla_referenciada(columna_tabla_referrenciada) ON DELETE action ON UPDATE action; -- Crear un índice después de crear la tabla CREATE INDEX index_name ON table_name (column1, column2, ...); CREATE TABLE IF NOT EXISTS tasks ( task_id INT AUTO_INCREMENT, employee_id INT NOT NULL, title VARCHAR(255) NOT NULL, start_date DATE, due_date DATE, status TINYINT NOT NULL, priority TINYINT NOT NULL, description TEXT, PRIMARY KEY (task_id), INDEX ix_title (title), FOREIGN KEY fk_employee(employee_id ) REFERENCES employee (employee_id ) ON DELETE RESTRICT ON UPDATE CASCADE ) ENGINE=INNODB;