MySQL은 데이터 베이스 소프트웨어입니다. 일반적으로 데이터를 추가하거나 검색, 추출하는 기능을 모두 포함해서 데이터베이스라고 부릅니다.
MySQL은 세계에서 가장 많이 쓰이는 오픈소스의 관계형 데이터베이스 관리시스템(RDBMS)입니다. MySQL은 PHP 스크립트 언어와 상호 연동이 잘 되면서 오픈소스를 개발된 무료 프로그램입니다. 그래서 홈페이지나 쇼핑몰(워드프로세스, cafe24, 제로보드, 그누보드)등 일반적으로 웹 개발에 널리 사용하고 있습니다.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
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.
webstoryboyhwang@Webstoryboyui-MacBookPro bin % ./mysql -uroot -proot
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 188
Server version: 5.7.34 MySQL Community Server (GPL)
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
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.
mysql> create database sample01;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sample01 |
| sys |
+--------------------+
5 rows in set (0.00 sec)
mysql> use sample01;
Database changed
mysql> drop database sample02;
Query OK, 0 rows affected (0.02 sec)
create table member (
myMemberID int(10) unsigned auto_increment,
youEmail varchar(40) NOT NULL,
youName varchar(20) NOT NULL,
youPass varchar(20) NOT NULL,
youBirth int(20) NOT NULL,
youAge int(5) NOT NULL,
regTime int(20) NOT NULL,
PRIMARY KEY (myMemberID)
) charset=utf8;
mysql> show tables;
+--------------------+
| Tables_in_sample01 |
+--------------------+
| member |
+--------------------+
1 row in set (0.00 sec)
mysql> desc member;
+------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+------------------+------+-----+---------+----------------+
| myMemberID | int(10) unsigned | NO | PRI | NULL | auto_increment |
| youEmail | varchar(40) | NO | | NULL | |
| youName | varchar(20) | NO | | NULL | |
| youPass | varchar(20) | NO | | NULL | |
| youBirth | int(20) | NO | | NULL | |
| regTime | int(20) | NO | | NULL | |
+------------+------------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)
mysql> drop table member;
Query OK, 0 rows affected (0.01 sec)
CREATE TABLE member3 SELECT * FROM member;
INSERT INTO member(youEmail, youName, youPass, youBirth, youAge, regTime) VALUES('webstoryboy@naver.com','황상연','1234','19990303','18','1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, youAge, regTime) VALUES('thdtjdgml415@naver.com', '송성희', '1234', '19970415','18', '1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, youAge, regTime) VALUES('mo0647@naver.com', '김민정', '1234', '19970530','18', '1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, youAge, regTime) VALUES('tjrwnsrkdtj@naver.com', '김석준', '1234', '19941009','18', '1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, youAge, regTime) VALUES('jwor124@naver.com', '정은비', '1234', '19990303','18', '1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, youAge, regTime) VALUES('leesh3432@naver.com','이영환','1234','19970205','18','1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, youAge, regTime) VALUES('sshin4882@naver.com','박현신','1234','19990303','18','1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, youAge, regTime) VALUES('to_before@naver.com', '김상준', '1234', '19970809','18', '04');
INSERT INTO member(youEmail, youName, youPass, youBirth, youAge, regTime) VALUES('kkb7528@naver.com','권규비','1234','19990303','18','1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, youAge, regTime) VALUES('piowm123@gmail.com', '문병내', '1234', '19990303','18', '1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, youAge, regTime) VALUES('ghkddbwls96@gmail.com', '황유진', '1234', '19990303','18', '1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, youAge, regTime) VALUES('eodnjs9605@naver.com','김대원','1234','19960530','18','1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, youAge, regTime) VALUES('wjsqhdus971007@gmail.com','전보연','1234','19971007','18','1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, youAge, regTime) VALUES('noeyheyh@gmail.com','권혜현','1234','19960331','18','1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, youAge, regTime) VALUES('hjkang306@gmail.com','강현지','1234','19990303','18','1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, youAge, regTime) VALUES('sunhey9810@gmail.com', '박선혜', '1234', '19981010','18', '1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, youAge, regTime) VALUES('kde66034@gmail.com', '김동언', '1234', '19700101','18', '1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, youAge, regTime) VALUES('praise1109@gmail.com', '이하은', '1234', '19990303','18', '1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, regTime) VALUES('ooooooo@naver.com', '1234', '19940404', '1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, regTime) VALUES('ooooo_oooooo@naver.com','1234','19990303','1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, regTime) VALUES('ooooo_oooooo@naver.com', '1234', '19970415', '1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, regTime) VALUES('ooooo_oooooo@naver.com', '1234', '19970530', '1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, regTime) VALUES('ooooo_oooooo@naver.com', '1234', '19941009', '1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, regTime) VALUES('ooooo_oooooo@naver.com', '1234', '19990303', '1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, regTime) VALUES('ooooo_oooooo@gmail.com', '1234', '20011009','1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, regTime) VALUES('ooooo_oooooo@naver.com','1234','19970205','1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, regTime) VALUES('ooooo_oooooo@naver.com','1234','19990303','1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, regTime) VALUES('ooooo_oooooo@naver.com','1234','19990303','1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, regTime) VALUES('ooooo_oooooo@gmail.com', '1234', '19990303', '1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, regTime) VALUE('ooooo_oooooo@gmail.com', '1234', '19990303', '1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, regTime) VALUES('ooooo_oooooo@gmail.com','1234','19970731','1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, regTime) VALUES('ooooo_oooooo@naver.com','1234','19960530','1234567')
INSERT INTO member(youEmail, youName, youPass, youBirth, regTime) VALUES('ooooo_oooooo@gmail.com','1234','19971007','1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, regTime) VALUES('ooooo_oooooo@gmail.com','1234','19960331','1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, regTime) VALUES('ooooo_oooooo@gmail.com','1234','19990303','1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, regTime) VALUES('ooooo_oooooo@gmail.com', '1234', '19981010', '1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, regTime) VALUE('ooooo_oooooo@gmail.com', '1234', '19700101', '1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, regTime) VALUES('ooooo_oooooo@gmail.com', '1234', '19990303', '1234567');
INSERT INTO member(youEmail, youName, youPass, youBirth, regTime) VALUES('ooooo_oooooo@naver.com', '3950', '20010415', '1234567');
mysql> SELECT * FROM member;
+------------+------------------------+------------+---------+----------+---------+
| myMemberID | youEmail | youName | youPass | youBirth | regTime |
+------------+------------------------+------------+---------+----------+---------+
| 1 | ooooo_oooooo@naver.com | 홍길동 | 1234 | 19940404 | 4 |
| 2 | ooooo_oooooo@naver.com | 홍길동 | 1234 | 19940404 | 1234567 |
| 3 | ooooo_oooooo@naver.com | 홍길동 | 1234 | 19990303 | 1234567 |
| 4 | ooooo_oooooo@naver.com | 홍길동 | 1234 | 19970415 | 1234567 |
| 5 | ooooo_oooooo@naver.com | 홍길동 | 1234 | 19970530 | 1234567 |
| 6 | ooooo_oooooo@naver.com | 홍길동 | 1234 | 19941009 | 1234567 |
| 7 | ooooo_oooooo@naver.com | 홍길동 | 1234 | 19990303 | 1234567 |
| 8 | ooooo_oooooo@naver.com | 홍길동 | 1234 | 20011009 | 1234567 |
| 9 | ooooo_oooooo@naver.com | 홍길동 | 1234 | 19970205 | 1234567 |
| 10 | ooooo_oooooo@naver.com | 홍길동 | 1234 | 19990303 | 1234567 |
| 11 | ooooo_oooooo@naver.com | 홍길동 | 1234 | 19990303 | 1234567 |
| 12 | ooooo_oooooo@naver.com | 홍길동 | 1234 | 19990303 | 1234567 |
| 13 | ooooo_oooooo@naver.com | 홍길동 | 1234 | 19990303 | 1234567 |
| 14 | ooooo_oooooo@naver.com | 홍길동 | 1234 | 19970731 | 1234567 |
| 15 | ooooo_oooooo@naver.com | 홍길동 | 1234 | 19960331 | 1234567 |
| 16 | ooooo_oooooo@naver.com | 홍길동 | 1234 | 19990303 | 1234567 |
| 17 | ooooo_oooooo@naver.com | 홍길동 | 1234 | 19981010 | 1234567 |
| 18 | ooooo_oooooo@naver.com | 홍길동 | 1234 | 19700101 | 1234567 |
| 19 | ooooo_oooooo@naver.com | 홍길동 | 1234 | 19990303 | 1234567 |
| 20 | ooooo_oooooo@naver.com | 홍길동 | 3950 | 20010415 | 1234567 |
+------------+------------------------+------------+---------+----------+---------+
20 rows in set (0.01 sec)
mysql> SELECT * FROM member WHERE myMemberID = 6;
+------------+---------------------+---------+---------+----------+---------+
| myMemberID | youEmail | youName | youPass | youBirth | regTime |
+------------+---------------------+---------+---------+----------+---------+
| 6 | ooooo_ooo@naver.com | 홍길동 | 1234 | 19970205 | 1234567 |
+------------+---------------------+---------+---------+----------+---------+
1 row in set (0.00 sec)
SELECT * FROM member WHERE myMemberID <> 6;
mysql> SELECT * FROM member WHERE myMemberID != 6;
+------------+--------------------------+---------+---------+----------+--------+----------+-----------+---------+
| myMemberID | youEmail | youName | youPass | youBirth | youAge | youPhone | youGender | regTime |
+------------+--------------------------+---------+---------+----------+--------+----------+-----------+---------+
| 1 | webstoryboy@naver.com | 황상연 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
| 2 | thdtjdgml415@naver.com | 송성희 | 1234 | 19970415 | 18 | 0 | x | 1234567 |
| 3 | mo0647@naver.com | 김민정 | 1234 | 19970530 | 18 | 0 | x | 1234567 |
| 4 | tjrwnsrkdtj@naver.com | 김석준 | 1234 | 19941009 | 18 | 0 | x | 1234567 |
| 5 | jwor124@naver.com | 정은비 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
| 7 | sshin4882@naver.com | 박현신 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
| 8 | to_before@naver.com | 김상준 | 1234 | 19970809 | 18 | 0 | x | 4 |
| 9 | kkb7528@naver.com | 권규비 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
| 10 | piowm123@gmail.com | 문병내 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
| 11 | ghkddbwls96@gmail.com | 황유진 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
| 12 | eodnjs9605@naver.com | 김대원 | 1234 | 19960530 | 18 | 0 | x | 1234567 |
| 13 | wjsqhdus971007@gmail.com | 전보연 | 1234 | 19971007 | 18 | 0 | x | 1234567 |
| 14 | noeyheyh@gmail.com | 권혜현 | 1234 | 19960331 | 18 | 0 | x | 1234567 |
| 15 | hjkang306@gmail.com | 강현지 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
| 16 | sunhey9810@gmail.com | 박선혜 | 1234 | 19981010 | 18 | 0 | x | 1234567 |
| 17 | kde66034@gmail.com | 김동언 | 1234 | 19700101 | 18 | 0 | x | 1234567 |
| 18 | praise1109@gmail.com | 이하은 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
+------------+--------------------------+---------+---------+----------+--------+----------+-----------+---------+
17 rows in set (0.00 sec)
mysql> SELECT * FROM member WHERE myMemberID >= 5 AND myMemberID <=10;
+------------+---------------------+---------+---------+----------+--------+----------+-----------+---------+
| myMemberID | youEmail | youName | youPass | youBirth | youAge | youPhone | youGender | regTime |
+------------+---------------------+---------+---------+----------+--------+----------+-----------+---------+
| 5 | jwor124@naver.com | 정은비 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
| 6 | leesh3432@naver.com | 이영환 | 1234 | 19970205 | 18 | 0 | x | 1234567 |
| 7 | sshin4882@naver.com | 박현신 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
| 8 | to_before@naver.com | 김상준 | 1234 | 19970809 | 18 | 0 | x | 4 |
| 9 | kkb7528@naver.com | 권규비 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
| 10 | piowm123@gmail.com | 문병내 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
+------------+---------------------+---------+---------+----------+--------+----------+-----------+---------+
6 rows in set (0.00 sec)
mysql> SELECT * FROM member WHERE myMemberID BETWEEN 5 AND 10;
+------------+---------------------+---------+---------+----------+--------+----------+-----------+---------+
| myMemberID | youEmail | youName | youPass | youBirth | youAge | youPhone | youGender | regTime |
+------------+---------------------+---------+---------+----------+--------+----------+-----------+---------+
| 5 | jwor124@naver.com | 정은비 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
| 6 | leesh3432@naver.com | 이영환 | 1234 | 19970205 | 18 | 0 | x | 1234567 |
| 7 | sshin4882@naver.com | 박현신 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
| 8 | to_before@naver.com | 김상준 | 1234 | 19970809 | 18 | 0 | x | 4 |
| 9 | kkb7528@naver.com | 권규비 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
| 10 | piowm123@gmail.com | 문병내 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
+------------+---------------------+---------+---------+----------+--------+----------+-----------+---------+
6 rows in set (0.00 sec)
mysql> SELECT * FROM member WHERE myMemberID NOT BETWEEN 5 AND 10;
+------------+--------------------------+---------+---------+----------+--------+----------+-----------+---------+
| myMemberID | youEmail | youName | youPass | youBirth | youAge | youPhone | youGender | regTime |
+------------+--------------------------+---------+---------+----------+--------+----------+-----------+---------+
| 1 | webstoryboy@naver.com | 황상연 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
| 2 | thdtjdgml415@naver.com | 송성희 | 1234 | 19970415 | 18 | 0 | x | 1234567 |
| 3 | mo0647@naver.com | 김민정 | 1234 | 19970530 | 18 | 0 | x | 1234567 |
| 4 | tjrwnsrkdtj@naver.com | 김석준 | 1234 | 19941009 | 18 | 0 | x | 1234567 |
| 11 | ghkddbwls96@gmail.com | 황유진 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
| 12 | eodnjs9605@naver.com | 김대원 | 1234 | 19960530 | 18 | 0 | x | 1234567 |
| 13 | wjsqhdus971007@gmail.com | 전보연 | 1234 | 19971007 | 18 | 0 | x | 1234567 |
| 14 | noeyheyh@gmail.com | 권혜현 | 1234 | 19960331 | 18 | 0 | x | 1234567 |
| 15 | hjkang306@gmail.com | 강현지 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
| 16 | sunhey9810@gmail.com | 박선혜 | 1234 | 19981010 | 18 | 0 | x | 1234567 |
| 17 | kde66034@gmail.com | 김동언 | 1234 | 19700101 | 18 | 0 | x | 1234567 |
| 18 | praise1109@gmail.com | 이하은 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
+------------+--------------------------+---------+---------+----------+--------+----------+-----------+---------+
12 rows in set (0.00 sec)
mysql> SELECT * FROM member WHERE myMemberID IN(1,4,10,14);
+------------+-----------------------+---------+---------+----------+--------+----------+-----------+---------+
| myMemberID | youEmail | youName | youPass | youBirth | youAge | youPhone | youGender | regTime |
+------------+-----------------------+---------+---------+----------+--------+----------+-----------+---------+
| 1 | webstoryboy@naver.com | 황상연 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
| 4 | tjrwnsrkdtj@naver.com | 김석준 | 1234 | 19941009 | 18 | 0 | x | 1234567 |
| 10 | piowm123@gmail.com | 문병내 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
| 14 | noeyheyh@gmail.com | 권혜현 | 1234 | 19960331 | 18 | 0 | x | 1234567 |
+------------+-----------------------+---------+---------+----------+--------+----------+-----------+---------+
4 rows in set (0.00 sec)
mysql> SELECT * FROM member WHERE youEmail LIKE '%naver%';
+------------+------------------------+------------+---------+----------+---------+
| myMemberID | youEmail | youName | youPass | youBirth | regTime |
+------------+------------------------+------------+---------+----------+---------+
| 1 | oooo_ooooooo@gmail.com | 홍길동 | 1234 | 19940404 | 4 |
| 2 | oooo_ooooooo@gmail.com | 홍길동 | 1234 | 19940404 | 1234567 |
| 3 | oooo_ooooooo@gmail.com | 홍길동 | 1234 | 19990303 | 1234567 |
| 4 | oooo_ooooooo@gmail.com | 홍길동 | 1234 | 19970415 | 1234567 |
| 5 | oooo_ooooooo@gmail.com | 홍길동 | 1234 | 19970530 | 1234567 |
| 6 | oooo_ooooooo@gmail.com | 홍길동 | 1234 | 19941009 | 1234567 |
| 7 | oooo_ooooooo@gmail.com | 홍길동 | 1234 | 19990303 | 1234567 |
| 9 | oooo_ooooooo@gmail.com | 홍길동 | 1234 | 19970205 | 1234567 |
| 10 | oooo_ooooooo@gmail.com | 홍길동 | 1234 | 19990303 | 1234567 |
| 11 | oooo_ooooooo@gmail.com | 홍길동 | 1234 | 19990303 | 1234567 |
| 20 | oooo_ooooooo@gmail.com | 홍길동 | 3950 | 20010415 | 1234567 |
+------------+------------------------+------------+---------+----------+---------+
10 rows in set (0.00 sec)
SELECT * FROM member WHERE youEmail LIKE 'web%';
SELECT * FROM member WHERE youEmail LIKE '%com';
+------------+--------------------------+---------+---------+----------+--------+----------+-----------+---------+
| myMemberID | youEmail | youName | youPass | youBirth | youAge | youPhone | youGender | regTime |
+------------+--------------------------+---------+---------+----------+--------+----------+-----------+---------+
| 1 | webstoryboy@naver.com | 황상연 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
| 2 | thdtjdgml415@naver.com | 송성희 | 1234 | 19970415 | 18 | 0 | x | 1234567 |
| 3 | mo0647@naver.com | 김민정 | 1234 | 19970530 | 18 | 0 | x | 1234567 |
| 4 | tjrwnsrkdtj@naver.com | 김석준 | 1234 | 19941009 | 18 | 0 | x | 1234567 |
| 5 | jwor124@naver.com | 정은비 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
| 6 | leesh3432@naver.com | 이영환 | 1234 | 19970205 | 18 | 0 | x | 1234567 |
| 7 | sshin4882@naver.com | 박현신 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
| 8 | to_before@naver.com | 김상준 | 1234 | 19970809 | 18 | 0 | x | 4 |
| 9 | kkb7528@naver.com | 권규비 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
| 10 | piowm123@gmail.com | 문병내 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
| 11 | ghkddbwls96@gmail.com | 황유진 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
| 12 | eodnjs9605@naver.com | 김대원 | 1234 | 19960530 | 18 | 0 | x | 1234567 |
| 13 | wjsqhdus971007@gmail.com | 전보연 | 1234 | 19971007 | 18 | 0 | x | 1234567 |
| 14 | noeyheyh@gmail.com | 권혜현 | 1234 | 19960331 | 18 | 0 | x | 1234567 |
| 15 | hjkang306@gmail.com | 강현지 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
| 16 | sunhey9810@gmail.com | 박선혜 | 1234 | 19981010 | 18 | 0 | x | 1234567 |
| 17 | kde66034@gmail.com | 김동언 | 1234 | 19700101 | 18 | 0 | x | 1234567 |
| 18 | praise1109@gmail.com | 이하은 | 1234 | 19990303 | 18 | 0 | x | 1234567 |
+------------+--------------------------+---------+---------+----------+--------+----------+-----------+---------+
18 rows in set (0.00 sec)
SELECT * FROM member WHERE youName LIKE '김%';
SELECT * FROM member WHERE youName LIKE '김%' OR youName LIKE '황%';
SELECT * FROM member WHERE youName LIKE '_상_';
SELECT * FROM member WHERE youName LIKE '__연';
SELECT * FROM member WHERE youName IS NULL;
SELECT * FROM member WHERE youName IS NOT NULL;
SELECT * FROM member WHERE youAge >=18 AND youName LIKE '김__';
SELECT * FROM member WHERE youAge >=18 OR youName LIKE '김__';
SELECT * FROM member WHERE (myMemberID = 2 OR myMemberID = 10) AND youAge >= 10;
SELECT * FROM member LIMIT 5;
SELECT * FROM member LIMIT 5, 5;
SELECT youEmail FROM member LIMIT 5;
UPDATE member SET youPhone = "010-0000-0000";
UPDATE member SET youPass = "123456" WHERE myMemberID = 3;
UPDATE member SET youPass = "1234567" WHERE myMemberID BETWEEN = 5 AND 10;
UPDATE member SET youPass = "1234567" ORDER BY youPass DESC LIMIT 10;
ALTER TABLE member ADD youPhone int(20) NOT NULL AFTER youAge;
ALTER TABLE member ADD youGender enum('m','w','x') default 'x' comment "남자 m 여자 w" AFTER youPhone;
ALTER TABLE member MODIFY youAge int(10);
ALTER TABLE member MODIFY youGender enum('m','w');
DELETE fROM member WHERE myMemberID = 5;
DELETE fROM member WHERE youPass = '1234';
DELETE fROM member ORDER BY youName LIMIT 5;
DELETE fROM member WHERE myMemberId IN(7,9,10);
create table myMember (
myMemberID int(10) unsigned auto_increment,
youEmail varchar(40) NOT NULL,
youName varchar(20) NOT NULL,
youPass varchar(20) NOT NULL,
youBirth int(20) NOT NULL,
youAge int(5) NOT NULL,
youPhone varchar(20) NOT NULL,
regTime int(20) NOT NULL,
PRIMARY KEY (myMemberID)
) charset=utf8;
create table myReview (
myReviewID int(10) unsigned auto_increment,
myMemberID int(10) unsigned,
youText tinytext NOT NULL,
regTime int(20) NOT NULL,
PRIMARY KEY (myReviewID)
) charset=utf8;
INSERT INTO myMember(youEmail, youName, youPass, youBirth, youAge, youPhone, regTime) VALUES('webstoryboy@naver.com','황상연','1234','19990303','20','01022223333','1234567');
INSERT INTO myMember(youEmail, youName, youPass, youBirth, youAge, youPhone, regTime) VALUES('thdtjdgml415@naver.com', '송성희', '1234', '19970415','30','01022223333', '1234567');
INSERT INTO myMember(youEmail, youName, youPass, youBirth, youAge, youPhone, regTime) VALUES('mo0647@naver.com', '김민정', '1234', '19970530','18','01022223333', '1234567');
INSERT INTO myMember(youEmail, youName, youPass, youBirth, youAge, youPhone, regTime) VALUES('tjrwnsrkdtj@naver.com', '김석준', '1234', '19941009','25','01022223333', '1234567');
INSERT INTO myMember(youEmail, youName, youPass, youBirth, youAge, youPhone, regTime) VALUES('jwor124@naver.com', '정은비', '1234', '19990303','22','01022223333', '1234567');
INSERT INTO myReview(myMemberID, youText, regTime) VALUES("1", "정말 감사합니다. 너무 좋네요!!", '1234567');
INSERT INTO myReview(myMemberID, youText, regTime) VALUES("2", "별로네요. 사지마세요!!", '1234567');
INSERT INTO myReview(myMemberID, youText, regTime) VALUES("3", "안녕하세요. 너무 좋네요!!", '1234567');
INSERT INTO myReview(myMemberID, youText, regTime) VALUES("4", "가성비 짱. 너무 좋네요!!", '1234567');
INSERT INTO myReview(myMemberID, youText, regTime) VALUES("5", "비추비추!!", '1234567');
INSERT INTO myReview(myMemberID, youText, regTime) VALUES("2", "훌륭합니다.", '1234567');
INSERT INTO myReview(myMemberID, youText, regTime) VALUES("3", "대박입니다.", '1234567');
INSERT INTO myReview(myMemberID, youText, regTime) VALUES("1", "올드합니다... 너무 좋네요!!", '1234567');
INSERT INTO myReview(myMemberID, youText, regTime) VALUES("4", "감사합니다. 너무 좋네요!!", '1234567');
SELECT m.youName, m.youEmail, r.youText, r.regTime FROM myMember m JOIN myReview r ON (m.myMemberID = r.myMemberID) ORDER BY myReviewID DESC LIMIT 5;