2020年2月24日

6447 ワード


select orders.id, orders.totalP
ice from order_items inner join
orders on users.id = orders.user_id where users.use
金科
チリン
ジョンからのブログ
https://www.codecademy.com/articles/sql-commands
今日、今日
mysql -u root
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '1234'
create database jtlim0414
show databases
+--------------------+
| Database |
+--------------------+
| information_schema |
| jtlim0414 |
| mysql |
| performance_schema |
| sys |
+--------------------+
5 rows in set (0.00 sec)
create table example(name char(10) DEFAULT NULL)
mysql> show tables
-> ;
+---------------------+
| Tables_in_jtlim0414 |
+---------------------+
| example |
+---------------------+
1 row in set (0.00 sec)
mysql> desc example
-> ;
+-------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+----------+------+-----+---------+-------+
| name | char(10) | YES | | NULL | |
+-------+----------+------+-----+---------+-------+
https://www.everdevel.com/MySQL/creating-table/
今日はFairと一緒のSchema
Table posts {
  id int [pk] // int = number
  user_id var  //"00_ng"
  image var // "star.jpg"
  test var
  tag var   // "# , #"
  like init
  comments var /// ['', '']
}


Table user {
  user_id var
  password var /// ****
  name var /// '임지택'
  email var  // '[email protected]'
  addr var   // '경기도'
  birth var  // "315"
  gender var // '남자'
  follow var // ["김코딩" , '...']
  follower var // ["김코딩"]
}

Table comments {
  id var [pk]
  post_id int
  user_id var
  text var
  time var
}

Table followers {
  user_id var
  follwers_id var
}

Table like {
  post_id int
  user_id var
}




Ref: "user"."user_id" < "posts"."user_id"

Ref: "user"."user_id" < "comments"."user_id"


Ref: "comments"."post_id" < "posts"."id"

Ref: "user"."user_id" < "followers"."user_id"

Ref: "comments"."id" < "like"."post_id"

理解できなかったのでYouTubeを見ました.
https://www.youtube.com/watch?v=cepspxPAUTA
https://www.youtube.com/watch?v=3BZz8R7mqu0
これは概念学習です.
https://www.youtube.com/watch?v=FR4QIeZaPeM