Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}
24 changes: 24 additions & 0 deletions data/schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
drop database pokedex2;
create database pokedex2;
use pokedex2;


drop table if exists pokemon;
CREATE TABLE pokemon(
id INT PRIMARY KEY NOT NULL,
img varchar(256),
name varchar(50)
);
drop table if exists type;
CREATE TABLE type (
id INT PRIMARY KEY NOT NULL,
name varchar(50)
);
drop table if exists pokemon_type;
CREATE TABLE pokemon_type (
id INT PRIMARY KEY NOT NULL auto_increment,
pokemonId INT NOT NULL,
FOREIGN KEY (pokemonId) REFERENCES pokemon(id),
typeId INT NOT NULL,
FOREIGN KEY (typeId) REFERENCES type(id)
);
21 changes: 21 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
let mysql = require("mysql");

let con = mysql.createConnection({
host:"localhost",
user: "root",
password: "password",
database: "Pokedex"
})

con.connect(err => {
if(err){
throw err;
}
con.query("SELECT * FROM pokemon", (err, result, fields) =>{
if(err){
throw err;
}
console.log(result)

})
});
Loading