Developers are generally tasked with creating interfaces that make it effortless for non-developers to look at and interact with information and facts stored in databases. Frequently these interfaces are acknowledged as Content Management Systems. In this homework assignment, your obstacle is to architect and construct a remedy for managing a company’s workforce employing node, inquirer, and MySQL.
Style and design the adhering to database schema that contains a few tables:
- id – INT Major Essential
- name – VARCHAR(30) to keep division name
- id – INT Most important Crucial
- title – VARCHAR(30) to keep purpose title
- wage – DECIMAL to keep job salary
- office_id – INT to maintain reference to office role belongs to
- id – INT Primary Key
- very first_name – VARCHAR(30) to hold staff very first name
- past_name – VARCHAR(30) to hold worker final title
- position_id – INT to hold reference to job personnel has
- supervisor_id – INT to keep reference to one more employee that supervisor of the present-day employee. This field might be null if the staff has no manager
Build a command-line application that at a bare minimum makes it possible for the consumer to:
Increase departments, roles, workers
Watch departments, roles, workers
Update employee roles
Reward details if you are in a position to:
Update employee managers
Check out personnel by manager
Delete departments, roles, and workers
Watch the whole utilized spending budget of a section — ie the mixed salaries of all employees in that office
We can body this challenge as follows:
As a company proprietor I want to be ready to view and deal with the departments, roles, and employees in my enterprise So that I can arrange and strategy my organization
How do you supply this? Below are some recommendations:
Use the MySQL NPM package deal to join to your MySQL database and carry out queries.
Use InquirerJs NPM offer to interact with the person by means of the command-line.
Use console.desk to print MySQL rows to the console. There is a crafted-in edition of
console.desk, but the NPM package deal formats the information a little better for our applications.
You may possibly wish to have a independent file containing capabilities for performing precise SQL queries you can expect to need to have to use. Could a constructor purpose or a class be useful for arranging these?
You will will need to accomplish a assortment of SQL JOINS to finish this assignment, and it can be encouraged you overview the week’s routines if you require a refresher on this.
You might would like to consist of a
seed.sqlfile to pre-populate your databases. This will make improvement of personal features a lot a lot easier.
Emphasis on receiving the basic operation accomplished prior to doing the job on more state-of-the-art characteristics.
Critique the week’s things to do for a refresher on MySQL.
Check out out SQL Bolt for some additional MySQL enable.