본문 바로가기

SQL 데이터베이스/Mysql

MySQL 5강

select * from mydata.sample_x1, mydata.sample_y1;
C	1
B	1
A	1
C	2


select mydata.sample_x1.x * mydata.sample_y1.y from mydata.sample_x1, mydata.sample_y1;
error


select mydata.sample_x1.x, mydata.sample_y1.y from mydata.sample_x1, mydata.sample_y1;
C	1
B	1
A	1
C	2


select x, y from mydata.sample_x1, mydata.sample_y1;
1
1
1
2


select x, x from mydata.sample_x1, mydata.sample_y2;
error


select mydata.sample_x1.x, mydata.sample_y2.x from mydata.sample_x1, mydata.sample_y2;
1
1
1
2


select * from mydata.pd, mydata.stock;
4	D	A	300	식료품	1	2021-01-03	200
3	C	A	1000	생활용품	1	2021-01-03	200
2	B	A	200	식료품	1	2021-01-03	200
1	A	A	100	식료품	1	2021-01-03	200
4	D	A	300	식료품	2	2021-02-10	500


select * from mydata.pd, mydata.stock where mydata.pd.code = mydata.stock.code;
1	A	A	100	식료품	1	2021-01-03	200
2	B	A	200	식료품	2	2021-02-10	500
3	C	A	1000	생활용품	3	2021-02-14	10


select * from mydata.pd inner join mydata.stock on mydata.pd.code = mydata.stock.code where mydata.pd.cf = "식료품";
1	A	A	100	식료품	1	2021-01-03	200
2	B	A	200	식료품	2	2021-02-10	500

'SQL 데이터베이스 > Mysql' 카테고리의 다른 글

MySQL 7강  (0) 2021.12.02
MySQL 6강  (0) 2021.12.02
MySQL 4강  (0) 2021.12.02
MySQL 3강  (0) 2021.12.01
MySQL 2강  (0) 2021.12.01