์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
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 |
- callback
- Project
- Import
- https://m.blog.naver.com/tt2t2am1118/221010125300
- https://youtube.com/playlist?list=PLuHgQVnccGMA5836CvWfieEQy0T0ov6Jh&si=FTaYv8m21EhO-A2K
- ๋น๋๊ธฐ
- ์ฐธ๊ณ ๋ธ๋ก๊ทธ
- mysql
- addEventListener
- eport
- Porject
- db
- execCommand
- sql
- await
- database
- webpack
- ๋๊ธฐ
- ํผํ
- prj
- js
- slow and steady
- ๊ฒ์
- object
- promise
- json
- JS #ํ๋ก์ ํธ
- setTimeout()
- async
- ajax
- Today
- Total
C-log
๐๏ธ๋์ SQL : ๋ณต์ต์ ํ์! ๋ณธ๋ฌธ
์ฐ๋ฆฌ๊ฐ ์ง๊ธ๊น์ง ๋ฐฐ์ด ๊ฒ์ผ๋ก SQL์ ์ถฉ๋ถํ ๋ค๋ฃฐ ์ ์๋ค. ๊ทธ๋์ TABLE๋ง ์์ฑํด๋ณด๋ คํ๋ค. ์ฐ์ ๋์๊ฒ ํ์ํ TABLE์ ํ์์ ์ ๋ณด๋ค์ด ๋ด๊ธด TALBEL์ด ํ์ํ๋ค ๊ฐ๊ธฐ ์์ ๋ช ๋ค์ด ์์ด์ผํ๊ณ ์ด๋ฅผ ํ ๋๋ก ํ๊ท ์ ๋ด์ด ์ฃผ๋ ๊ตฌ์กฐ๋ฅผ ๋ง๋ค์ด ๋ด์ผํ๋ค. ์ฐ์ Excelํ์ผ๋ก ๋ด๊ฐ ์๊ฐํ๋ TABLE์ ๋์์ธํด๋ณด๋ ค ํ๋ค. ์๋ ์ด๋ฏธ์ง๋ฅผ ์ฐธ๊ณ ํ์.
1. CREATE DATABASE
๋จผ์ ๋์ DATABASE๋ฅผ ์์ฑํ์ ๊ทธ๋ฆฌ๊ณ ์์ฑ๋ DATABASE๋ฅผ ํ์ธํ์.
MariaDB [opentutorials]> CREATE DATABASE grade_card;
Query OK, 1 row affected (0.011 sec)
MariaDB [opentutorials]> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| grade_card |
| information_schema |
| mysql |
| opentutorials |
| performance_schema |
| phpmyadmin |
| test |
+--------------------+
7 rows in set (0.004 sec)
MariaDB [opentutorials]> use grade_card
Database changed
2. CREATE TABLE
MariaDB [grade_card]> CREATE TABLE grade(
-> id INT(20) NOT NULL AUTO_INCREMENT,
-> name VARCHAR(100) NOT NULL,
-> math INT(100) NOT NULL,
-> korean INT(100) NOT NULL,
-> english INT(100) NOT NULL,
-> science INT(100) NOT NULL,
-> k_history INT(100) NOT NULL,
-> date DATETIME NOT NULL,
-> semester VARCHAR(50) NULL,
-> PRIMARY KEY(id)
-> );
Query OK, 0 rows affected (0.027 sec)
์ด๋ ๊ฒ TABLE์ ์์ฑํด์ฃผ๊ณ ํด๋น TABLE์ ํ์ธํ๋ฉด ์๋์ ๊ฐ๋ค.
MariaDB [grade_card]> DESC grade;
+-----------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+--------------+------+-----+---------+----------------+
| id | int(20) | NO | PRI | NULL | auto_increment |
| name | varchar(100) | NO | | NULL | |
| math | int(100) | NO | | NULL | |
| korean | int(100) | NO | | NULL | |
| english | int(100) | NO | | NULL | |
| science | int(100) | NO | | NULL | |
| k_history | int(100) | NO | | NULL | |
| date | datetime | NO | | NULL | |
| semester | varchar(50) | YES | | NULL | |
+-----------+--------------+------+-----+---------+----------------+
9 rows in set (0.016 sec)
๋ง์ง๋ง์ผ๋ก ํด๋น TABLE์ ๋ฐ์ดํฐ ๊ฐ์ ๊ธฐ์ ํด ๋ณด์.
3. INSERT INTO grade (-) VALUES(-);
MariaDB [grade_card]> INSERT INTO grade (name,math,korean,english,science,k_history,date,semester)
VALUES('a',65,78,77,56,80,NOW(),2);
Query OK, 1 row affected (0.004 sec)
์์ ๋ช ๋ น๋ฌธ์ผ๋ก a๋ผ๋ ํ์์ ์ฑ์ ์ ๊ธฐ์ ํ๋ค. ๊ธฐ์ ํ ์คํค๋ง๋ ์๋์ ๊ฐ๋ค.
SELECT * FROM grade;
MariaDB [grade_card]> SELECT * FROM grade;
+----+------+------+--------+---------+---------+-----------+---------------------+----------+
| id | name | math | korean | english | science | k_history | date | semester |
+----+------+------+--------+---------+---------+-----------+---------------------+----------+
| 1 | a | 65 | 78 | 77 | 56 | 80 | 2023-09-11 20:52:53 | 2 |
+----+------+------+--------+---------+---------+-----------+---------------------+----------+
1 row in set (0.001 sec)
์ด๋ ๊ฒ ๋ชจ๋ ๊ฐ๋ค์ ๋์ ํ๊ณ ์์ฑ๋ ์คํค๋ง๋ ์๋์ ๊ฐ๋ค.
'DB > ๐ฌMySQL' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
๐๏ธ๋์ SQL : UPDATE (0) | 2023.09.11 |
---|---|
๐๏ธ๋์ SQL : SELECT (0) | 2023.09.10 |
๐๏ธ๋์ SQL : INSERT (0) | 2023.09.10 |
๐๏ธ๋์ SQL : TABLE ์์ฑํ๊ธฐ ๊ทธ๋ฆฌ๊ณ Workbech (0) | 2023.09.09 |
๐๏ธ๋์ SQL : Create DataBase (0) | 2023.09.09 |