MySQL은 오픈 소스 관계형 데이터베이스 관리 시스템(RDMS)입니다.
MySQL은 다중 사용자, 다중 스레드 RDBMS로서, 데이터의 안정성과 보안성을 제공합니다. MySQL은 대부분의 운영 체제에서 작동하며, 웹 애플리케이션 개발, 데이터 분석, 빅 데이터, 클라우드 기반 애플리케이션 등에 많이 사용됩니다.
MySQL은 SQL(Structured Query Language)을 사용하여 데이터를 관리합니다. SQL은 데이터베이스에 저장된 데이터를 조작하기 위한 표준적인 언어로서, 데이터를 검색, 삽입, 업데이트, 삭제하는데 사용됩니다. MySQL은 이러한 SQL 문을 이용하여 데이터를 쿼리하고, 데이터의 무결성을 유지하며, 데이터베이스를 관리합니다.
MySQL은 사용이 간편하며, 대용량 데이터베이스를 처리할 수 있는 고성능 기능을 제공합니다. 또한, 오픈 소스로서, 다양한 개발자들이 지속적으로 개발 및 유지보수하고 있어, 사용자들이 다양한 문제들을 해결할 수 있는 방법을 제공합니다.
MySQL은 PHP 스크립트 언어와 상호 연동이 잘 되면서 오픈소스로 개발된 무료 프로그램입니다. 그래서 홈페이지나 쇼핑몰(워드프레스,Cafe24, 그누보드, 제로보드 등)에 가장 일반적으로 웹 개발에 멀리 사용하고 있습니다.
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.24 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
create table members(
memberID int(10) unsigned auto_increment,
youEmail varchar(40) NOT NULL,
youName varchar(10) NOT NULL,
youPass varchar(50) NOT NULL,
youAge int(5) NOT NULL,
regTime int(20) NOT NULL,
PRIMARY KEY(memberID)
) charset=utf8;
mysql> show tables;
+---------------+
| Tables_in_aaa |
+---------------+
| members |
+---------------+
1 row in set (0.00 sec)
mysql> desc members;
+----------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+------------------+------+-----+---------+----------------+
| memberID | int(10) unsigned | NO | PRI | NULL | auto_increment |
| youEmail | varchar(40) | NO | | NULL | |
| youName | varchar(10) | NO | | NULL | |
| youPass | varchar(50) | NO | | NULL | |
| youAge | int(5) | NO | | NULL | |
| regTime | int(20) | NO | | NULL | |
+----------+------------------+------+-----+---------+----------------+
6 rows in set (0.01 sec)
INSERT INTO members(youEmail, youName, youPass, youPhone, regTime) VALUES("webstoryboy@naver.com", "황상연", "9876", "010-0000-0000", "1695711476");
INSERT INTO members(youEmail, youName, youPass, youPhone, regTime) VALUES("lee.jiyoung492@gmail.com", "이지영", "0106", "010-0000-0000", "1695711476");
INSERT INTO members(youEmail, youName, youPass, youPhone, regTime) VALUES("capitaljs10@gmail.com", "윤지성", "9876", "010-0000-0000", "1695711476");
INSERT INTO members(youEmail, youName, youPass, youPhone, regTime) VALUES("wolves941110@gmail.com", "강서현", "0000", "010-0000-0000", "1695711476");
INSERT INTO members(youEmail, youName, youPass, youPhone, regTime) VALUES("jeongsaeyeong@gmail.com", "정새영", "1234", "010-0000-0000", "1695711476");
INSERT INTO members(youEmail, youName, youPass, youPhone, regTime) VALUES("chfhrdk@gmail.com", "권초록", "1234", "010-0000-0000", "1695711476");
INSERT INTO members(youEmail, youName, youPass, youPhone, regTime) VALUES("hongjihyeon1004@gmail.com", "홍지현", "1111", "010-0000-0000", "1695711476");
INSERT INTO members(youEmail, youName, youPass, youPhone, regTime) VALUES("tmddnrla1@naver.com", "김승우", "7768", "010-0000-0000", "1695711476");
INSERT INTO members(youEmail, youName, youPass, youPhone, regTime) VALUES("dbwls9038@naver.com", "정유진", "8151", "010-0000-0000", "1695711476");
INSERT INTO members(youEmail, youName, youPass, youPhone, regTime) VALUES("answlsgh95@gmail.com", "문진호", "9999", "010-0000-0000", "1695711476");
INSERT INTO members(youEmail, youName, youPass, youPhone, regTime) VALUES("adorabelness1215@naver.com", "이혜민", "0624", "010-0000-0000", "1695711476");
INSERT INTO members(youEmail, youName, youPass, youPhone, regTime) VALUES("duddls6552@naver.com", "문영인", "1234", "010-0000-0000", "1695711476");
INSERT INTO members(youEmail, youName, youPass, youPhone, regTime) VALUES("audgns722@naver.com", "이명훈", "1212", "010-0000-0000", "1695711476");
INSERT INTO members(youEmail, youName, youPass, youPhone, regTime) VALUES("elese0821@naver.com", "이원영", "0821", "010-0000-0000", "1695711476");
INSERT INTO members(youEmail, youName, youPass, youPhone, regTime) VALUES("kmdojs@gmail.com", "오종석", "1234", "010-0000-0000", "1695711476");
INSERT INTO members(youEmail, youName, youPass, youPhone, regTime) VALUES("imdoob@naver.com", "임종한", "3125", "010-0000-0000", "1695711476");
INSERT INTO members(youEmail, youName, youPass, youPhone, regTime) VALUES("rlanrider@gmail.com", "김우주", "1234", "010-0000-0000", "1695711476");
INSERT INTO members(youEmail, youName, youPass, youPhone, regTime) VALUES("yunyoungsik91@gmail.com", "윤영식", "12345", "010-0000-0000", "1695711476");
INSERT INTO members(youEmail, youName, youPass, youPhone, regTime) VALUES("97.eugene.s@gmail.com", "서유진", "9876", "010-0000-0000", "1695711476");
INSERT INTO members(youEmail, youName, youPass, youPhone, regTime) VALUES("jhyjhy968@gmail.com", "정해연", "1234", "010-0000-0000", "1695711476");
INSERT INTO members(youEmail, youName, youPass, youPhone, regTime) VALUES("hee031812@gmail.com", "김희진", "9099", "010-0000-0000", "1695711476");
SELECT * FROM members;
SELECT youName FROM members;
SELECT youName, youAge FROM members;
SELECT youEmail, youName, youAge FROM members;
SELECT * FROM members WHERE memberID = 1;
SELECT youName, youEmail FROM members WHERE memberID = 10;
SELECT * FROM members WHERE youAge >= 30;
SELECT * FROM members WHERE youAge <> 30;
SELECT * FROM members WHERE memberID > 5 AND memberID < 10;
SELECT * FROM members WHERE youAge BETWEEN 30 AND 40;
SELECT * FROM members WHERE youAge NOT BETWEEN 30 AND 40;
SELECT * FROM members WHERE memberID IN(1,5,10,15);
SELECT * FROM members WHERE youName IS NULL;
SELECT * FROM members WHERE youName IS NOT NULL;
SELECT * FROM members WHERE youName LIKE '%연%';
SELECT * FROM members WHERE youName LIKE '김%';
SELECT * FROM members WHERE youName LIKE '%연';
SELECT * FROM members WHERE youName LIKE '__성';
SELECT * FROM members WHERE youName LIKE '김%' OR youName LIKE '이%';
SELECT * FROM members WHERE youAge >= 25 AND memberID IN (2, 9);
SELECT * FROM members WHERE (memberID = 2 OR memberID = 9) AND youAge >= 25
SELECT * FROM members LIMIT 5;
SELECT * FROM members LIMIT 5, 5;
SELECT youEmail FROM members LIMIT 10, 10;
SELECT DISTINCT youAge FROM members;
SELECT count(youName) FROM members;
SELECT count(*) FROM members;
SELECT youName FROM members ORDER BY youName ASC;
SELECT youName FROM members ORDER BY youName DESC;
UPDATE members SET youPass = "1234";
UPDATE members SET youPass = "1111" WHERE memberID = 15;
UPDATE members SET youPass = "7777" WHERE memberID BETWEEN 5 AND 10;
DELETE FROM members WHERE memberID = 5;
DELETE FROM members WHERE youPass = "1111";
DELETE FROM members ORDER BY memberID LIMIT 5;
DELETE FROM members WHERE memberID IN(16, 18, 20);
ALTER TABLE members ADD youPhone varchar(20) NOT NULL;
ALTER TABLE members ADD youPhone varchar(20) NOT NULL AFTER youAge;
ALTER TABLE members MODIFY youPhone int(20) NOT NULL;
ALTER TABLE members DROP youPhone;