์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- prj
- slow and steady
- webpack
- json
- ๋๊ธฐ
- object
- Project
- https://youtube.com/playlist?list=PLuHgQVnccGMA5836CvWfieEQy0T0ov6Jh&si=FTaYv8m21EhO-A2K
- Porject
- ํผํ
- ์ฐธ๊ณ ๋ธ๋ก๊ทธ
- mysql
- promise
- execCommand
- ๋น๋๊ธฐ
- ๊ฒ์
- database
- JS #ํ๋ก์ ํธ
- https://m.blog.naver.com/tt2t2am1118/221010125300
- ajax
- Import
- async
- addEventListener
- setTimeout()
- await
- db
- sql
- callback
- js
- eport
- Today
- Total
C-log
๐๏ธ๋์ SQL : INSERT ๋ณธ๋ฌธ
์ด๋ฒ ๊ฐ์์์๋ ๋ฐ์ดํฐ๋ฅผ ์ถ๊ฐํ๋ ๋ฐฉ๋ฒ์ ์ดํด๋ณผ ๊ฒ์ด๋ค. ์ฐ๋ฆฌ๊ฐ INSERT๋ฅผ ์ฌ์ฉํ๊ธฐ ์ ์ TABLE์ด ์ ๊ตฌ์กฐํ ๋์ด ์๋์ง ๋ณด๊ธฐ ์ํด์๋ ์๋ ์ฝ๋๋ฅผ ์ฌ์ฉํ๋ฉด TBALE์ ๋ชจ์ต์ ํ์ธ ํ ์ ์๋ค.
DESC topic;
MariaDB [opentutorials]> DESC topic;
+-------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| title | varchar(100) | NO | | NULL | |
| description | text | YES | | NULL | |
| created | datetime | NO | | NULL | |
| author | varchar(30) | YES | | NULL | |
| profile | varchar(100) | YES | | NULL | |
+-------------+--------------+------+-----+---------+----------------+
6 rows in set (0.023 sec)
์ด์ ๋ฐ์ดํฐ๋ฅผ ๊ธฐ์ ํด๋ณด์ ๊ธฐ์ ํ๊ธฐ ์ํด์๋ INSERT INTO topic์ ์ฌ์ฉํ๋ฉด ๋๋ค. (topic์ ์ฌ์ฉํ TABLE๋ช ์ ์ ๋ ฅํ๋ฉด ๋๋ค.)
INSERT INTO topic(~)VALUES(~);
MariaDB [opentutorials]> INSERT INTO topic (title,description,created,author,profile)
VALUES('MySQL','MySQL is ...',NOW(),'egoing','developer');
Query OK, 1 row affected (0.058 sec)
์ฐ๋ฆฌ๊ฐ ์์ DESC๋ฅผ ํตํด ํ์ธํ TABLE์ ๊ตฌ์กฐ์ ๋ง์ถฐ์ ๊ฐ์ ๋์ ํด์ฃผ๋ฉด ๋๋ค.
์ฐ๋ฆฌ๊ฐ ๊ธฐ์ ํ ๋ฐ์ดํฐ๋ฅผ ๊ฐ์ ธ์ค๊ธฐ ์ํด์๋ SELECT * FROM topic ๋ช ๋ น์ด๋ฅผ ์ฌ์ฉํ๋ฉด ๋๋ค.
SELECT * FROM topic;
MariaDB [opentutorials]> SELECT * FROM topic;
+----+-------+--------------+---------------------+--------+-----------+
| id | title | description | created | author | profile |
+----+-------+--------------+---------------------+--------+-----------+
| 1 | MySQL | MySQL is ... | 2023-09-10 15:36:30 | egoing | developer |
+----+-------+--------------+---------------------+--------+-----------+
1 row in set (0.000 sec)
์ฌ๊ธฐ์ ์ ์๊ฐํด ๋ด์ผํ๋ ๊ฒ์ DESC topic๋ช ๋ น๋ฌธ์ ์ฐ๋ฆฌ๊ฐ ๋ง๋ค์ด ๋์ TABLE์ ๊ตฌ์กฐ๋ฅผ ํ์ธ ํ ์ ์๋ ๋ช ๋ น์ด์ธ ๊ฒ์ด๋ค. ์ฆ, ์์์ ํ์ธ ํ ์ ์๋ ๊ฒ์ด๋ค. ๊ทธ๋ฆฌ๊ณ ์ฐ๋ฆฌ๊ฐ ๋ฐ์ดํฐ๋ฅผ ๊ธฐ์ ํ๊ณ ์ ๋ ฅํ ๋ถ๋ถ์ ๊ฐ์ ํ์ธํ๋ ๊ฒ์ ํด๋น TABLE๋ช ์ ์ง๋ช ํ๊ณ SELECT * FROM์ด๋ผ๋ ๋ช ๋ น์ด๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ด๋ค. ์๋ ์ฝ๋๋ ์ดํ ๋ค๋ฅธ ๋ฐ์ดํฐ ๊ฐ์ ๊ธฐ์ ํ TABLE์ด๋ค.
MariaDB [opentutorials]> INSERT INTO topic (title,description,created,author,profile)
VALUES('ORACLE','ORACLE is ...',NOW(),'egoing','developer');
Query OK, 1 row affected (0.005 sec)
MariaDB [opentutorials]> INSERT INTO topic (title,description,created,author,profile)
VALUES('SQL Server','SQL Server is ...',NOW(),'duru','data administrator');
Query OK, 1 row affected (0.005 sec)
MariaDB [opentutorials]> INSERT INTO topic (title,description,created,author,profile)
VALUES('PostgreSQL','PostgreSQL is ...',NOW(),'taeho','data scientist, developer');
Query OK, 1 row affected (0.004 sec)
MariaDB [opentutorials]> INSERT INTO topic (title,description,created,author,profile)
VALUES('MongoDB','MongoDB is ...',NOW(),'egoing','developer');
Query OK, 1 row affected (0.004 sec)
MariaDB [opentutorials]> SELECT * FROM topic;
+----+------------+-------------------+---------------------+--------+---------------------------+
| id | title | description | created | author | profile |
+----+------------+-------------------+---------------------+--------+---------------------------+
| 1 | MySQL | MySQL is ... | 2023-09-10 15:36:30 | egoing | developer |
| 2 | ORACLE | ORACLE is ... | 2023-09-10 15:51:16 | egoing | developer |
| 3 | SQL Server | SQL Server is ... | 2023-09-10 15:57:25 | duru | data administrator |
| 4 | PostgreSQL | PostgreSQL is ... | 2023-09-10 15:58:31 | taeho | data scientist, developer |
| 5 | MongoDB | MongoDB is ... | 2023-09-10 15:59:20 | egoing | developer |
+----+------------+-------------------+---------------------+--------+---------------------------+
5 rows in set (0.000 sec)
'DB > ๐ฌMySQL' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
๐๏ธ๋์ SQL : SELECT (0) | 2023.09.10 |
---|---|
๐๏ธ๋์ SQL : ๋ณต์ต์ ํ์! (0) | 2023.09.10 |
๐๏ธ๋์ SQL : TABLE ์์ฑํ๊ธฐ ๊ทธ๋ฆฌ๊ณ Workbech (0) | 2023.09.09 |
๐๏ธ๋์ SQL : Create DataBase (0) | 2023.09.09 |
๐๏ธ๋์ SQL : SQL Cheat Sheet (0) | 2023.09.09 |