case
like if else without all the if/else
case
when then
when then
else
end
end
end
- self = calling on the object
CRUD Create Read Update Destroy (used with databases)
[2, 11, 37, 42]map! do |n|
n + 5
end
- takes an array ([2, 11, 37, 42])
.mapcreates a new array- updates the new array with (n+5)
- destroys the old array
RESTful Design representational state transfer
GET- Read POST - Create PUT - Replace Update PATCH - Merge Update (only to make one change) DELETE - Destroy
get "/movies"
get "/movies/:id"
post "/movies"
patch "/movies/:id/authors"
put "/movies/:id"
delete "/movies/:id"
- most often used with http but used with JS, js.node, ruby, most platforms
- when POSTing a new hash, the database will create a new id for the new item
*"Who is the fool? The fool who goes or the fool who follows him?" -Obiwan
*BACKEND- store and manipulate data *relationship between browser and web app
*Types of databases
-
json
-
realtion
-
sql
-
xml
-
spreadsheet (csv)
-
Key/Value
-
Brands *Mongo, SQLite, Postgress, Oracle
- Sturucted Query Language
- relational algebra symbols
*Select, Insert, Update, Delete
-
Classes = Tables(CSV)
-
Arrays = result set (several rows)
-
Hash(instance) = row
-
keys(properties/attributes) - column, field names
-
values = fields
-
schemaall tables in a database -
SELECT * FROMdisplays all the fields from that class -
INSERT INTO"table name" (name the parameters) VALUES (specifics with the parameters) -
WHEREmore specific parameters -
LIKE "dav%"will search for anything with those parameters -
can look at all the products or all the users of the products
-
Ex. How to look up a specific users wishlist
SELECT user_id, product_id FROM wishlists WHERE user_id = 9 -
EX. how to look up a specific
product SELECT name FROM products WHERE id = 4