You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Lesson 1: Basics of creation, insertion and retrieval of data
1
+
# Lesson 1: Server setup and Basics of creation, insertion and retrieval of data
2
+
3
+
Objective : This module aims to incorporate JavaScript code to operate the MySQL database.
4
+
MySQL client can be used to demonstrate SQL queries however, students should know how to
5
+
make a MySQL database connection from JavaScript, run queries from JavaScript and
6
+
capture results of queries in JavaScript.
7
+
8
+
## Pre-Class Preparation
9
+
- Install MySQL using the following [official docs](https://dev.mysql.com/downloads/mysql/)
10
+
- MAC users may use `brew install mysql`
11
+
12
+
Before arriving to class on Sunday, please watch all of the videos in [this video playlist](https://www.lynda.com/SharedPlaylist/0299ced540444d7197460e7f1f74ddab) on Lynda.
13
+
If you actually manage to watch them all and understand everything,
14
+
then you are a database expert.
15
+
16
+
## Setup
17
+
18
+
### MySQL setup
19
+
This setup assumes MySQL version 8.0.
20
+
Windows users should use **Microsoft MySQL Command Line** client.
21
+
Linux and MAC users should use **gnome-terminal** and **Terminal** respectively.
22
+
**Microsoft MySQL Command Line** client gives you a **msql>** prompt after typing in your root password.
23
+
Note that this password is the one you used for root user of the mysql.
24
+
Linux and MAC users can execute `mysql -uroot -p` and then type the password.
25
+
Following commands should be run under the **mysql>** prompt:
26
+
```
27
+
mysql> create user ‘hyfuser’@‘localhost’ identified with mysql_native_password by ‘hyfpassword’;
28
+
# This command creates a user 'hyfuser' with password 'hyfpassword' for
29
+
# the database server at 'localhost'
30
+
31
+
mysql> grant all privileges on *.* to ‘hyfuser’@‘localhost’;
32
+
# This command gives all permissions to user 'hyfuser'.
33
+
(*.*) means every table of every database.
34
+
35
+
mysql> create database userdb;
36
+
This command creates a database 'userdb'
37
+
```
38
+
39
+
### Node setup
40
+
This setup assumes that you have Node.js 0.6 or higher.
41
+
We use **mysqljs** driver which can be installed using `npm install mysql`
42
+
43
+
### Verification of the correct setup
44
+
Run `node connection-test.js` from VScode(Windows) or the terminal(Linux or MAC).
45
+
The output should be `The solution is: 2`.
46
+
connection-test.js can be found in the Week1 folder.
2
47
3
48
In this class, students will be introduced to
4
49
@@ -10,26 +55,8 @@ Objective: Students should be able to create tables,
10
55
insert values in tables and
11
56
retrieve data from tables using SELECT statements that include FROM, WHERE clauses.
12
57
13
-
## Pre-Class Readings
14
-
15
-
Before arriving to class on Sunday, please watch all of the videos in [this video playlist](https://www.lynda.com/SharedPlaylist/0299ced540444d7197460e7f1f74ddab) on Lynda.
16
-
- What are databases?
17
-
- Exploring databases and database management systems
18
-
- The features of a relational database
19
-
- Introduction to database modeling
20
-
- Using the basic SELECT statement
21
-
- Creating SQL queries
22
-
- Structuring the WHERE clause
23
-
- Sorting query results
24
-
- Using aggregate functions
25
-
- Joining tables
26
-
27
-
## Pre-Class Preparation
28
-
- Install MySQL using the following [official docs](https://dev.mysql.com/downloads/mysql/)
29
-
- MAC users may use `brew install mysql`
30
58
31
-
32
-
## Main Topics
59
+
## Topics to be covered
33
60
34
61
- The relational model of data
35
62
- A 'database' vs. a 'DBMS' (database management system)
@@ -42,8 +69,107 @@ Before arriving to class on Sunday, please watch all of the videos in [this vide
0 commit comments