select orders.id, orders.totalP
ice from order_items inner join
orders on users.id = orders.user_id where users.use
name = "김코
딩";
요한님이 보내주신 블로그
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/
오늘 페어분과 함께한 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 // 'jtlim0414@gmail.com'
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"
이해가 가지 않아서 유투브를 보게 되었다.
https://www.youtube.com/watch?v=cepspxPAUTA