다음 학기에는 PHP OCU나 들어 볼까?….
^^…
그냥 붙이기 한다 알아서 읽어. 동환…
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:Documents and Settingsmiru>mysql
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 11 to server version: 3.23.41-nt
Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the buffer.
mysql> create database ocu;
Query OK, 1 row affected (0.02 sec)
mysql> show databases;
+———-+
| Database |
+———-+
| flywithu |
| mysql |
| ocu |
| test |
+———-+
4 rows in set (0.00 sec)
mysql> use ocu;
Database changed
mysql> create table score)
-> ;
ERROR 1064: You have an error in your SQL syntax near ‘)’ at line 1
mysql> crate table score(
-> name tinytext,
-> ocuid tinytext,
-> php int(5),
-> java int(5),
-> asp int(5)
-> );
ERROR 1064: You have an error in your SQL syntax near ‘crate table score(
name tinytext,
ocuid tinytext,
php int(5),
java int(5),
asp i’ at line 1
mysql> create table score(
-> name tinytext,
-> ocuid tinytext,
-> php int(5),
-> java int(5),
-> asp int(5)
-> );
Query OK, 0 rows affected (0.00 sec)
mysql> desc score;
+——-+———-+——+—–+———+——-+
| Field | Type | Null | Key | Default | Extra |
+——-+———-+——+—–+———+——-+
| name | tinytext | YES | | NULL | |
| ocuid | tinytext | YES | | NULL | |
| php | int(5) | YES | | NULL | |
| java | int(5) | YES | | NULL | |
| asp | int(5) | YES | | NULL | |
+——-+———-+——+—–+———+——-+
5 rows in set (0.00 sec)
mysql> load data local infile ‘c:/test.sql’ into table score fields terminated b
y ‘|’;
Query OK, 12 rows affected (0.00 sec)
Records: 12 Deleted: 0 Skipped: 0 Warnings: 0
mysql> select * from score;
+——–+—————-+——+——+——+
| name | ocuid | php | java | asp |
+——–+—————-+——+——+——+
| 고석찬 | ih11940742 | 83 | 84 | 62 |
| 고선경 | sswu199834763 | 96 | 98 | 98 |
| 권태호 | pknu97194010 | 65 | 78 | 65 |
| 김기환 | ih11940746 | 89 | 84 | 64 |
| 권순우 | skku1996311287 | 63 | 96 | 92 |
| 김세미 | pknu97136009 | 64 | 75 | 91 |
| 표현진 | sswu199834768 | 61 | 74 | 88 |
| 이홍석 | skku1997312979 | 82 | 71 | 70 |
| 임재향 | sswu199934762 | 66 | 99 | 74 |
| 송정민 | ih11941643 | 98 | 62 | 99 |
| 신유승 | skku1994313023 | 77 | 78 | 89 |
| 육은정 | sswu199834041 | 62 | 82 | 64 |
+——–+—————-+——+——+——+
12 rows in set (0.00 sec)
mysql> select * from score where substring(ocuid,1,4)=’pknu’;
+——–+————–+——+——+——+
| name | ocuid | php | java | asp |
+——–+————–+——+——+——+
| 권태호 | pknu97194010 | 65 | 78 | 65 |
| 김세미 | pknu97136009 | 64 | 75 | 91 |
+——–+————–+——+——+——+
2 rows in set (0.00 sec)
mysql> update score set php=php+5 where php<65;
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0
mysql> select * from score;
+——–+—————-+——+——+——+
| name | ocuid | php | java | asp |
+——–+—————-+——+——+——+
| 고석찬 | ih11940742 | 83 | 84 | 62 |
| 고선경 | sswu199834763 | 96 | 98 | 98 |
| 권태호 | pknu97194010 | 65 | 78 | 65 |
| 김기환 | ih11940746 | 89 | 84 | 64 |
| 권순우 | skku1996311287 | 68 | 96 | 92 |
| 김세미 | pknu97136009 | 69 | 75 | 91 |
| 표현진 | sswu199834768 | 66 | 74 | 88 |
| 이홍석 | skku1997312979 | 82 | 71 | 70 |
| 임재향 | sswu199934762 | 66 | 99 | 74 |
| 송정민 | ih11941643 | 98 | 62 | 99 |
| 신유승 | skku1994313023 | 77 | 78 | 89 |
| 육은정 | sswu199834041 | 67 | 82 | 64 |
+——–+—————-+——+——+——+
12 rows in set (0.00 sec)
mysql> select avg(java) from score where java>75;
+———–+
| avg(java) |
+———–+
| 87.3750 |
+———–+
1 row in set (0.00 sec)
mysql>