Inquirer & SQL queries Backend
- This program is designed to build a employee database using mysql && the functionality of modifying the database in the terminal window using inquirer.js.
- This project was completed based on the Node.js, inquirer.js and mysql database, and can be run once installed.
- I have learned the ways to work at the server-side of javaScript database development, so that the front-end can retrieve the data by a set of query statements.
- JavaScript
- Node.js
- npm (inquirer.js)
- npm (mysql2)
- npm (console.table)
- How to install & how to use: https://drive.google.com/file/d/1S-kOSdN9TpeFM9DgXSlrc8HUmYtJdAM6/view
- How to seed the database with data: https://drive.google.com/file/d/1CtpPGW-dNAHRgXEdWSWkr6izdURe-R_b/view
- Open Gitbash/terminal, navigate towards your project location from your root by using "cd ./ project location"
- Choose a clone option from the "Employee_Tracker_BE" repository (either HTTPS or SSH should work)
- In Gitbash, type "git clone HTTPS or SSH"
- Once the clone is successful, navigate to the root directory of this repo.
- Enter
npm init
into the terminal. - Enter
npm install inquirer
into the terminal to install the inquirer.js package, Enternpm install console.table --save
into the terminal to install the console.table package and enternpm install mysql2
to install the mysql2 package and you are good to go!
-
In your command window/gitbash shell, enter
mysql -u root -p
and then type your password of your sql account. -
Now in your sql command window, type in
source db/db.sql
to create a new database calledemployee_tracker_db
-
type in
source db/schema.sql
to feed the relational tables into the database. -
type in
source db/seeds.sql
to seed some customized data into the tables.
-
Type in
SELECT * FROM employee
Your initial-stage employee table should look like:
-
Navigate (
cd
) to the root directory in your terminal. Enternode index.js
, if the question prompts started to appear, you can proceed. -
After each task, you can answer 'Y' or 'y' to the followUp question to return to the main menu or say 'N' or 'n' to exit. \