hackyourfuture / databases Goto Github PK
View Code? Open in Web Editor NEWThis repository contains all the material for the HackYourFuture module "Databases: Store and retrieve data with MySQL"
This repository contains all the material for the HackYourFuture module "Databases: Store and retrieve data with MySQL"
INSERT INTO database_reading_material (unique_key) VALUES ('An example of how to define a unique key when creating a table') 🙂
Homework Databases Week 2 has a section 2. Prep-exercises. It tells a student to find QA_PREP_EXERCISE.md
:
QA_PREP_EXERCISE.md
doesn't have that much content.For being able to install MySQL via brew in mac systems, users should install brew package manager first via this command:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
This command can be added in https://github.com/HackYourFuture/databases/blob/master/Week1/README.md
The link, given in the homework week2 ( https://github.com/mysqljs/mysql ) is not enough to learn "prepared statements". It is slightly explaining. This source I think pretty enough to learn the topic:
http://www.mysqltutorial.org/mysql-prepared-statement.aspx
Students where asking about set autocommit = 0
In my opinion we shouldn't mention this syntax and only keep the subject concise by only talking about START TRANSACTION
, COMMIT
and ROLLBACK
These keywords do the same as set autocommit
but are better words that are also found in ORM's and even in other DBs.
Some of the apostrophes have to be changed into single quotes to run the code properly. The parts that have to be corrected in "setting up code" must be as shown in bullets:
mysql> create user ‘hyfuser’@‘localhost’ identified with mysql_native_password by ‘hyfpassword’;
# This command creates a user 'hyfuser' with password 'hyfpassword' for
# the database server at 'localhost'
mysql> grant all privileges on *.* to ‘hyfuser’@‘localhost’;
# This command gives all permissions to user 'hyfuser'.
(*.*) means every table of every database.
The link in the first line of Week1/MAKEME.md is redirecting you to MySQL Community Server download page. I noticed that some of the students downloaded MySQL from here, but couldn't install it because, this edition doesn't include any executable setup file(I noticed that for Windows systems). Link can be changed with this one which belongs to complete MySQL installer:
By week 3 the students are used to work with the promisified execQuery.
The exercise could be upgraded so there are less questions about the weirdness / old school approach.
const execQuery = util.promisify(connection.query.bind(connection));
async function getPopulationFromCountry(name, code) {
// assuming that connection to the database is established and stored as conn
return execQuery(
`SELECT Population FROM `country` WHERE Name = '${name}' and code = '${code}'`
);
}
This subject is highly theoretical (and even feels unnatural to and to students) when designing a database.
IMHO without this topic they would be just a good in database designing as without it.
And i'd rather include some other topic like
In the readme "How to set up your first database" a comment before msyql> flush privileges;
is not descriptive enough. What flush means?
Instead of "Step 3: This command flushes all privileges" should be "Step 3: This command updates all privileges enabling the changes to take effect without reloading or restarting MySQL" or something.
I think the database module is complex as javascript modules. Students (we) are preparing their self to hardness and complexity of javascript but not to the database. I think they should be warned for the database module as they were warned for javascript. Because MySQL is one of the most important tools for us to keep it in our skills.
Briefly, there should be a useful full tutorial for SQL. Mostly preferred a video. I think a source as a video with examples in it is the most efficient way to learn. Therefore before the week1 of the database, this full tutorial of MySQL could be very useful:
https://www.youtube.com/watch?v=HXV3zeQKqGY
(And I have to say that I did not like the last part. It is better not to watch the last part which is the introduction to ERD. )
Chapter:
2. What are entities?
The video about 'Entities vs. Database' doesn't work. This link: https://www.youtube.com/watch?v=hBu2pdphYaA
MySQL installation on linux machines might be a struggle for students starting database module.
By Unmesh's request, I recorded a video about it. It might be useful to put link in the repo.
Because of (uesr_id ) field in todo_items table don't accept a null value then We can add it directly in the query string or we can use it as a parameter.
it's not a 'versus' discussion, it's about what data to put in which db.
Most (big) projects these days use both types of DB's in a single project
MySQL is useful for most of the data in all applications. Every application needs to start relational for example with entities like users
, companies
, subscription
etc. Since most of the data we deal with is relational by nature.
NoSQL is useful for:
○ data collection without the time to properly normalize it in advance (e.g. collect log data and user activity without knowing what to do with it)
○ search engines (e.g. ElasticSearch)
○ for caching (you can put all data in a single document, skipping joins and allowing duplicate data)
To bad MongoDB has been hyped and in use for general purposes.
This leads to skipping proper database design and will give trouble on schema changes
It's easy to simply store your JS objects as JSON in Mongo but thats just as easy in Postgress or MySQL.
Some comments from people wishing they never started using MongoDB:
https://www.reddit.com/r/node/comments/8r263o/why_should_i_use_mongodb_and_not_mysql_with_node/#thing_t1_e0pfb21
Both links in week 2 reading material in What are identifier Keys section are the same link.
Prep exercise week 2 aka QA_PREP_EXERCISE.md
has a block-quote:
All the vegetarian recipes with potatoes All the cakes that do not need baking All the vegan and Japanese recipes
...which probably should be a bullet list.
This doesn't work:
PREPARE example FROM SELECT name, salary FROM employees where id = ?;
It looks like it should be this instead:
PREPARE example FROM 'SELECT name, salary FROM employees where id = ?';
[6.] Select the top 3 countries by population that their names start with the later ‘P’
later => letter
MAKEME.md of "Homework Databases Week 1" has the wrong order of sections.
I think "Prep exercises" should go before "MySQL exercises" since "Prep exercises" are required before the Q&A session, and "MySQL exercises" are not. Other weeks follow the proposed order, and this week is the only exception.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.