-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSQL_01.txt
More file actions
105 lines (105 loc) · 2.83 KB
/
SQL_01.txt
File metadata and controls
105 lines (105 loc) · 2.83 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
SQLite version 3.35.5 2021-04-19 18:32:05
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .oepn 'c:\\dd\\abd'
Error: unknown command or invalid arguments: "oepn". Enter ".help" for help
sqlite> .open 'c:\\dd\\adb'
sqlite> .mo co
sqlite> .he on
sqlite> create table mt(mount, alt);
sqlite> .ta
city mt score
sqlite> .import 'c:\\dd\\mt.txt' mt
sqlite> select * from mt;
mount alt
----- ----
설악산 1900
지로산 2915
덕유산 1300
sqlite> select alt, mount from mt;
alt mount
---- -----
1900 설악산
2915 지로산
1300 덕유산
sqlite> select mount as'산이름' alt as'해발' from mt;
Error: near "alt": syntax error
sqlite> select mount as'산이름', alt as'해발' from mt;
산이름 해발
--- ----
설악산 1900
지로산 2915
덕유산 1300
sqlite> insert into mt values('한라산',1950);
sqlite> select mount as'산이름', alt as'해발' from mt;
산이름 해발
--- ----
설악산 1900
지로산 2915
덕유산 1300
한라산 1950
sqlite> update mt set alt = 1708 where mount = '설악산';
sqlite> select mount as'산이름', alt as'해발' from mt;
산이름 해발
--- ----
설악산 1708
지로산 2915
덕유산 1300
한라산 1950
sqlite> update mt set alt = '지리산' where mount = '지로산';
sqlite> select mount as'산이름', alt as'해발' from mt;
산이름 해발
--- ----
설악산 1708
지로산 지리산
덕유산 1300
한라산 1950
sqlite> update mt set alt = 2915 where alt = '지리산';
sqlite> select mount as'산이름', alt as'해발' from mt;
산이름 해발
--- ----
설악산 1708
지로산 2915
덕유산 1300
한라산 1950
sqlite> update mt set mount = '지로산' where mount = '지리산';
sqlite> select mount as'산이름', alt as'해발' from mt;
산이름 해발
--- ----
설악산 1708
지로산 2915
덕유산 1300
한라산 1950
sqlite> update mt set mount = '지리산' where mount = '지로산';
sqlite> select mount as'산이름', alt as'해발' from mt;
산이름 해발
--- ----
설악산 1708
지리산 2915
덕유산 1300
한라산 1950
sqlite> .schema
CREATE TABLE score(name, kor, eng, mat);
CREATE TABLE city(city_name, city_pop);
CREATE TABLE mt(mount, alt);
sqlite> drop table mt;
sqlite> .schema
CREATE TABLE score(name, kor, eng, mat);
CREATE TABLE city(city_name, city_pop);
sqlite>
----------------------------------------
sqlite> select * from score;
name kor eng mat
---- --- --- ---
이순신 85 87 90
강감찬 75 80 95
한석봉 99 98 99
황진이 35 45 20
안중근 90 85 90
박문수 95 98 96
임꺽정 15 35 45
김정호 90 95 80
정몽주 90 90 95
오우석 50 45 60
sqlite>