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 @@
{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add .vscode folder to the .gitignore

"liveServer.settings.port": 5501
}
43 changes: 43 additions & 0 deletions data/schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
DROP DATABASE IF EXISTS Pokedex;
CREATE DATABASE Pokedex;

USE Pokedex;

CREATE TABLE IF NOT EXISTS pokemon (
pokemonID INT PRIMARY KEY,
pokemonName VARCHAR(128),
sprite TEXT(65535)
);


CREATE TABLE IF NOT EXISTS pokeType (
typeID INT PRIMARY KEY,
pokemonType VARCHAR (128)
);


CREATE TABLE IF NOT EXISTS mapType (
mappingID INT,
pokemonID INT,
typeID INT,
FOREIGN KEY (pokemonID) REFERENCES pokemon (pokemonID),
FOREIGN KEY (typeID) REFERENCES pokeType (typeID)
);

INSERT INTO
pokemon (
pokemonID,
pokemonName,
sprite
)
VALUES
(
"1",
"Bulbasaur",
"https://www.https://www.google.com/imgres?imgurl=https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fen%2F2%2F28%2FPok%25C3%25A9mon_Bulbasaur_art.png&imgrefurl=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FBulbasaur&tbnid=KtgjmFXIcd8sVM&vet=12ahUKEwjh5ZKN34PvAhX5lXIEHXNuABQQMygAegUIARDlAQ..i&docid=dDlg1E6hw6SY6M&w=275&h=256&q=image%20bulbasaur&ved=2ahUKEwjh5ZKN34PvAhX5lXIEHXNuABQQMygAegUIARDlAQ#imgrc=KtgjmFXIcd8sVM&imgdii=7QuAFbKQuiFkrM"
);

INSERT INTO
pokeType (typeID, pokemonType)
VALUES
("1", "grass");
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: "KillEric5050",
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