This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Schedule { | |
starting:string, | |
ending:string, | |
enabled:boolean | |
day?:string | |
} | |
interface Scheduling { | |
[k:string]: Schedule | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In a one to many relationship these things are key. | |
Suppose you have two tables, one users and the other is orders. In the users table you can have columns such as | |
PRIMARY_KEY UNIQUE AUTO_INCREMENT number, VARCHAR(255) email. | |
The orders table you have the column order_date date, PRIMARY_KEY AUTO_INCREMENT UNIQUE, price FLOAT, FOREIGN_KEY users.PRIMARY_KEY | |
This would be a parent - child relationship, the parent is the users and the child is the orders. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If you have two tables suppose Users table and a UsersProfile Table. | |
In your users table you will have things like user_id PRIMARY_KEY AUTO_INCREMENT/SERIAL, email VARCHAR(244), password varchar(12) | |
In your user_profile table you will have PRIMARY_KEY users.user_id FOREIGN_KEY users.user_id, first_name VARHCAR(122), last_name VARCHAR(133) | |
The primary and foreign key needs to be referencing the users table. The reason for this because it forces data integrity, and forcing a one to one relationship | |
between the two tables. | |
One-toOne relationships are typically used to split the data that may not always be needed together or to seperate sensitive information into | |
a seperate table, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sum = [5, 1, 4, 8] | |
const reduceFunction = sum.reduce(function(accumulator, currentValue) { | |
return accumulator + currentValue | |
},0) | |
accumulator is either the initial value to begin with which is the second argument, or the total of the iteration, the last iteration will be the result. | |
current value will be each element. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const menuAndCategory = [ | |
{ | |
menu_name: "First Menu", | |
menu_description: "I love menus and everything it brings me ", | |
menu_unique_menu_id: "7d491498-8702-41ba-af53-4dff90f46fc8", | |
category_name: "Breakfast", | |
unique_category_id: "71f317cb-6376-4435-ba6c-3a57d006bca6", | |
product_id: "eda57dcf-234f-423a-9ee3-433e8264ab91", | |
}, | |
{ |