<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ko">
		<id>http://dh.aks.ac.kr/~seonae/wiki/index.php?action=history&amp;feed=atom&amp;title=2018-2_%EC%88%98%EC%97%85%EC%8B%9C%EA%B0%84sql</id>
		<title>2018-2 수업시간sql - 편집 역사</title>
		<link rel="self" type="application/atom+xml" href="http://dh.aks.ac.kr/~seonae/wiki/index.php?action=history&amp;feed=atom&amp;title=2018-2_%EC%88%98%EC%97%85%EC%8B%9C%EA%B0%84sql"/>
		<link rel="alternate" type="text/html" href="http://dh.aks.ac.kr/~seonae/wiki/index.php?title=2018-2_%EC%88%98%EC%97%85%EC%8B%9C%EA%B0%84sql&amp;action=history"/>
		<updated>2026-05-26T13:44:28Z</updated>
		<subtitle>이 문서의 편집 역사</subtitle>
		<generator>MediaWiki 1.27.5</generator>

	<entry>
		<id>http://dh.aks.ac.kr/~seonae/wiki/index.php?title=2018-2_%EC%88%98%EC%97%85%EC%8B%9C%EA%B0%84sql&amp;diff=85&amp;oldid=prev</id>
		<title>Seonae: /* 181213 */</title>
		<link rel="alternate" type="text/html" href="http://dh.aks.ac.kr/~seonae/wiki/index.php?title=2018-2_%EC%88%98%EC%97%85%EC%8B%9C%EA%B0%84sql&amp;diff=85&amp;oldid=prev"/>
				<updated>2018-12-18T12:39:26Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;181213&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='ko'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← 이전 판&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;2018년 12월 18일 (화) 12:39 판&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l323&quot; &gt;323번째 줄:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;323번째 줄:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[#top]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[#top&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;|위로&lt;/ins&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Seonae</name></author>	</entry>

	<entry>
		<id>http://dh.aks.ac.kr/~seonae/wiki/index.php?title=2018-2_%EC%88%98%EC%97%85%EC%8B%9C%EA%B0%84sql&amp;diff=84&amp;oldid=prev</id>
		<title>2018년 12월 18일 (화) 12:39에 Seonae님의 편집</title>
		<link rel="alternate" type="text/html" href="http://dh.aks.ac.kr/~seonae/wiki/index.php?title=2018-2_%EC%88%98%EC%97%85%EC%8B%9C%EA%B0%84sql&amp;diff=84&amp;oldid=prev"/>
				<updated>2018-12-18T12:39:04Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='ko'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← 이전 판&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;2018년 12월 18일 (화) 12:39 판&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l322&quot; &gt;322번째 줄:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;322번째 줄:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;select * from tour2018s_person&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;select * from tour2018s_person&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[#top]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Seonae</name></author>	</entry>

	<entry>
		<id>http://dh.aks.ac.kr/~seonae/wiki/index.php?title=2018-2_%EC%88%98%EC%97%85%EC%8B%9C%EA%B0%84sql&amp;diff=83&amp;oldid=prev</id>
		<title>Seonae: /* 181213 */</title>
		<link rel="alternate" type="text/html" href="http://dh.aks.ac.kr/~seonae/wiki/index.php?title=2018-2_%EC%88%98%EC%97%85%EC%8B%9C%EA%B0%84sql&amp;diff=83&amp;oldid=prev"/>
				<updated>2018-12-18T12:26:12Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;181213&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='ko'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← 이전 판&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;2018년 12월 18일 (화) 12:26 판&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l322&quot; &gt;322번째 줄:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;322번째 줄:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;select * from tour2018s_person&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;select * from tour2018s_person&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[#]]&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Seonae</name></author>	</entry>

	<entry>
		<id>http://dh.aks.ac.kr/~seonae/wiki/index.php?title=2018-2_%EC%88%98%EC%97%85%EC%8B%9C%EA%B0%84sql&amp;diff=82&amp;oldid=prev</id>
		<title>2018년 12월 18일 (화) 12:25에 Seonae님의 편집</title>
		<link rel="alternate" type="text/html" href="http://dh.aks.ac.kr/~seonae/wiki/index.php?title=2018-2_%EC%88%98%EC%97%85%EC%8B%9C%EA%B0%84sql&amp;diff=82&amp;oldid=prev"/>
				<updated>2018-12-18T12:25:38Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='ko'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← 이전 판&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;2018년 12월 18일 (화) 12:25 판&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l322&quot; &gt;322번째 줄:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;322번째 줄:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;select * from tour2018s_person&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;select * from tour2018s_person&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[#]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Seonae</name></author>	</entry>

	<entry>
		<id>http://dh.aks.ac.kr/~seonae/wiki/index.php?title=2018-2_%EC%88%98%EC%97%85%EC%8B%9C%EA%B0%84sql&amp;diff=81&amp;oldid=prev</id>
		<title>Seonae: 새 문서: ==181004== &lt;pre&gt;use db;  select * from sys.tables  select * from ebhPhoto$ create table ebhPhoto01( id nvarchar(16) not null, province nvarchar(8) null, site nvarchar(40) null, domain...</title>
		<link rel="alternate" type="text/html" href="http://dh.aks.ac.kr/~seonae/wiki/index.php?title=2018-2_%EC%88%98%EC%97%85%EC%8B%9C%EA%B0%84sql&amp;diff=81&amp;oldid=prev"/>
				<updated>2018-12-18T12:23:37Z</updated>
		
		<summary type="html">&lt;p&gt;새 문서: ==181004== &amp;lt;pre&amp;gt;use db;  select * from sys.tables  select * from ebhPhoto$ create table ebhPhoto01( id nvarchar(16) not null, province nvarchar(8) null, site nvarchar(40) null, domain...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;새 문서&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==181004==&lt;br /&gt;
&amp;lt;pre&amp;gt;use db;&lt;br /&gt;
&lt;br /&gt;
select * from sys.tables&lt;br /&gt;
&lt;br /&gt;
select * from ebhPhoto$&lt;br /&gt;
create table ebhPhoto01(&lt;br /&gt;
id nvarchar(16) not null,&lt;br /&gt;
province nvarchar(8) null,&lt;br /&gt;
site nvarchar(40) null,&lt;br /&gt;
domain nvarchar(40) null,&lt;br /&gt;
domainType nvarchar(4) null,&lt;br /&gt;
photoUrl nvarchar(256) null,&lt;br /&gt;
iconUrl nvarchar(256) null,&lt;br /&gt;
caption nvarchar(256) null,&lt;br /&gt;
wikiFile nvarchar(80) null,&lt;br /&gt;
primary key(id)&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
select * from ebhPhoto$ where domainType = 3&lt;br /&gt;
--숫자는 인용부호가 없어도 됨. &lt;br /&gt;
&lt;br /&gt;
insert into ebhPhoto01&lt;br /&gt;
select * from ebhPhoto$ where domainType = 3&lt;br /&gt;
-- insert문을 이용하여 테이블 데이터 넣기&lt;br /&gt;
--각 개별칼럼별로 가져와서 넣으려면 into에도 column name을 지정.&lt;br /&gt;
-- 쓰리 콤보 , insert, update, delete&lt;br /&gt;
select * from ebhPhoto01&lt;br /&gt;
&lt;br /&gt;
update ebhPhoto01 &lt;br /&gt;
set domainType = '3' where domainType is null&lt;br /&gt;
&lt;br /&gt;
--보통은 입력 순서대로 들어가지만 id를 pk로 지정했기 때문에 pk기준으로 정렬됨&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==181018==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
use db&lt;br /&gt;
select * into institute from common.dbo.institute&lt;br /&gt;
select * into program from common.dbo.program&lt;br /&gt;
select * into person from common.dbo.person&lt;br /&gt;
select * into journal from common.dbo.journal&lt;br /&gt;
select * into library from common.dbo.library&lt;br /&gt;
select * into affiliation from common.dbo.affiliation&lt;br /&gt;
&lt;br /&gt;
select * from institute order by zone&lt;br /&gt;
select institute_name, type, state_name from institute &lt;br /&gt;
where type != 'EDU' order by type, state_name, institute_name&lt;br /&gt;
&lt;br /&gt;
select institute_name, state_name, latitude from institute where latitude &amp;lt; 0&lt;br /&gt;
&lt;br /&gt;
select * from institute where hasGis = 1&lt;br /&gt;
&lt;br /&gt;
select * from institute where institute_name like 'University%'&lt;br /&gt;
select * from institute where institute_name like '%University'&lt;br /&gt;
&lt;br /&gt;
select * from institute where state_name ='호주' or state_name = '뉴질랜드'&lt;br /&gt;
select * from institute where (state_name ='호주' or state_name = '뉴질랜드') and type = 'EDU'&lt;br /&gt;
&lt;br /&gt;
select * from institute where state_name in ('중국', '일본', '베트남', '인도네시아') order by state&lt;br /&gt;
&lt;br /&gt;
select * from institute where state_name = '미국' order by institute_name desc&lt;br /&gt;
&lt;br /&gt;
select top 10 * from institute&lt;br /&gt;
&lt;br /&gt;
select zone, state_name, count(*) from institute &lt;br /&gt;
group by zone, state_name order by zone, state_name&lt;br /&gt;
&lt;br /&gt;
select distinct state_name from institute&lt;br /&gt;
select distinct type from institute&lt;br /&gt;
select zone, count(zone) from institute group by zone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==181025==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use db;&lt;br /&gt;
&lt;br /&gt;
select * from affiliation --person_name, institute_id, program_id&lt;br /&gt;
select * from institute &lt;br /&gt;
select * from journal --institute_id&lt;br /&gt;
select * from library --institute_id, program_id&lt;br /&gt;
select * from person &lt;br /&gt;
select * from program where program_name is null--institute_id&lt;br /&gt;
select * from program where institute_id is null--institute_id&lt;br /&gt;
&lt;br /&gt;
--테이블을 한꺼번에 가져오면 생길수 있는 모든 경우의 수를 생성.&lt;br /&gt;
&lt;br /&gt;
--한국학프로그램이 있는 곳의 프로그램, 나라, 대학, 학과, 프로그램 시작날짜&lt;br /&gt;
select program_name, state_name, institute_name, department, establishment &lt;br /&gt;
from institute join program on institute.institute_id = program.institute_id&lt;br /&gt;
&lt;br /&gt;
select program_name, state_name, institute_name, department, establishment &lt;br /&gt;
from institute, program where institute.institute_id = program.institute_id&lt;br /&gt;
--2가지 방식으로 쓸 수 있지만 join문을 선호하는 것은 inner이외의 join도 쓸 수 있기 때문.&lt;br /&gt;
&lt;br /&gt;
--해외한국학 대학중에 저널을 간행하는 곳이나 도서관이 있는 곳은 규모가 큼. &lt;br /&gt;
--해외에 있는 한국학 도서관이나 저널을 보자&lt;br /&gt;
select library.institute_id, journal_name, library_name from library &lt;br /&gt;
full outer join journal on library.institute_id = journal.institute_id&lt;br /&gt;
--dbo 말고 sys가 있음&lt;br /&gt;
-- full outer, left outer, right outer&lt;br /&gt;
--도서관이랑 저널이 두개 있는 곳과 도서관만 있는 곳을 전부 보겠음. &lt;br /&gt;
select library.institute_id, journal_name, library_name from library &lt;br /&gt;
right outer join journal on library.institute_id = journal.institute_id&lt;br /&gt;
--갯수가 늘어났다는 것은 대학에 2개이상이 있을 수 있다는 것.&lt;br /&gt;
&lt;br /&gt;
--도서관은 있는데 저널은 없는 곳.&lt;br /&gt;
select library.institute_id, journal_name, library_name from library &lt;br /&gt;
left outer join journal on library.institute_id = journal.institute_id&lt;br /&gt;
where journal_name is null&lt;br /&gt;
--저널은 있는데 도서관은 없는 곳.&lt;br /&gt;
select journal.institute_id, journal_name, library_name from library &lt;br /&gt;
right outer join journal on library.institute_id = journal.institute_id&lt;br /&gt;
where library_name is null&lt;br /&gt;
--데이터가 없는 경우에 outer를 많이 씀. 조사한 것중에 빠진게 있는지.&lt;br /&gt;
&lt;br /&gt;
select state_name, institute_name&lt;br /&gt;
from institute left outer join program on institute.institute_id = program.institute_id&lt;br /&gt;
where program.institute_id is null&lt;br /&gt;
--where program_name is null&lt;br /&gt;
--한쪽의 id값을 기준으로 null값을 찾는것이 좀더 정확함. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==181108==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use db&lt;br /&gt;
&lt;br /&gt;
select * from sys.tables&lt;br /&gt;
select * from sys.views&lt;br /&gt;
--sys 컴퓨터가 만드는 테이블&lt;br /&gt;
&lt;br /&gt;
select * from dbo.ebhPhoto&lt;br /&gt;
&lt;br /&gt;
--캡션을 다 채워넣는게 미션&lt;br /&gt;
select id, domain, caption, wikiFile from ebhPhoto&lt;br /&gt;
where caption is null&lt;br /&gt;
&lt;br /&gt;
--delete 하려면 where 조건 넣어야 함&lt;br /&gt;
--db는 백업데이터를 항상 만들어두는 것이 좋음.&lt;br /&gt;
&lt;br /&gt;
--1) 백업데이터 부터 만들기&lt;br /&gt;
select * into ebhPhoto2 from ebhPhoto&lt;br /&gt;
&lt;br /&gt;
--2) 원본 작업할 것만 빼고 제외&lt;br /&gt;
select * from ebhPhoto where domain != '남원_실상사'&lt;br /&gt;
&lt;br /&gt;
--3) 남기고 지우기&lt;br /&gt;
delete ebhPhoto where domain != '남원_실상사'&lt;br /&gt;
&lt;br /&gt;
--4) 확인&lt;br /&gt;
select * from ebhPhoto&lt;br /&gt;
&lt;br /&gt;
--지우고 다시 복구 중... 껍데기도 지우느냐, 다시 삽입하냐&lt;br /&gt;
--1) 껍데기 살리고 데이터 가져오기&lt;br /&gt;
insert into ebhPhoto&lt;br /&gt;
select * from ebhPhoto2&lt;br /&gt;
&lt;br /&gt;
select * from ebhPhoto&lt;br /&gt;
&lt;br /&gt;
--2) 내것만 추출해서 다른 db로&lt;br /&gt;
select * into myPhoto from ebhPhoto where domain = '남원_실상사'&lt;br /&gt;
&lt;br /&gt;
select id, domain, caption, wikiFile from myPhoto where caption is null&lt;br /&gt;
&lt;br /&gt;
--캡션 바꾸는 방법&lt;br /&gt;
select * from myPhoto&lt;br /&gt;
&lt;br /&gt;
--insert into의 위치. 맨 앞이면 기존에 추가하는거. select 뒤에 넣으면 새로 테이블 만들기.&lt;br /&gt;
update myPhoto&lt;br /&gt;
set caption = '남원 실상사 증각 스틸' where id = 'EBJL145'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==181122==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use VH2018;&lt;br /&gt;
&lt;br /&gt;
/*자기가 직접 데이터 업로드*/&lt;br /&gt;
&lt;br /&gt;
--자기가 만든 데이터 확인&lt;br /&gt;
select * from 자기디비.dbo.myPhoto2&lt;br /&gt;
select * from 자기디비.dbo.myPhoto&lt;br /&gt;
&lt;br /&gt;
--교수님께서 새로 생성하신 통합 테이블&lt;br /&gt;
select * from ebhPhotoNew&lt;br /&gt;
&lt;br /&gt;
--새 테이블에 내 데이터 넣기(이미 다 들어감)&lt;br /&gt;
INSERT INTO ebhPhotoNew&lt;br /&gt;
select * from 자기디비.dbo.myPhoto2&lt;br /&gt;
&lt;br /&gt;
--데이터가 제대로 들어갔는지 확인하기. (빠진 목록 확인하기)&lt;br /&gt;
select * from ebhPhoto left join ebhPhotoNew &lt;br /&gt;
on ebhPhoto.id = ebhPhotoNew.id&lt;br /&gt;
where ebhPhotoNew.id is null&lt;br /&gt;
&lt;br /&gt;
--캡션만 추가하는 방법(실행하지 마세요)&lt;br /&gt;
insert into ebhPhotoNew&lt;br /&gt;
select ebhPhoto.id, ebhPhoto.province, ebhPhoto.site, ebhPhoto.domain,&lt;br /&gt;
ebhPhoto.domainType, ebhPhoto.photoUrl, ebhPhoto.iconUrl, 자기디비.dbo.myPhoto2.caption,&lt;br /&gt;
ebhPhoto.wikiFile from ebhPhoto join 자기디비.dbo.myPhoto2 on ebhPhoto.id = 자기디비.dbo.myPhoto2.id&lt;br /&gt;
--다른 데이터베이스에서 update하는 것은 프로시저를 짜야함&lt;br /&gt;
--가장 간단한 방법은 새로 파일을 만들어서 insert하면 됨.&lt;br /&gt;
--2개의 테이블에서 가져와야 하므로, join해서 가져올 것.&lt;br /&gt;
&lt;br /&gt;
--중복 데이터 제거하기(중복된 경우에만 지우고 다시 insert)&lt;br /&gt;
--delete ebhPhotoNew &lt;br /&gt;
--where domain in ('영주_부석사', '양평_용문사', '영월_법흥사', '영주_비로사')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==181129==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use db;&lt;br /&gt;
&lt;br /&gt;
--&lt;br /&gt;
declare @term nvarchar(30)&lt;br /&gt;
set @term=N'견마기(肩亇只)';&lt;br /&gt;
select @term&lt;br /&gt;
&lt;br /&gt;
--&lt;br /&gt;
SELECT id, xmltxt FROM tour2018s&lt;br /&gt;
&lt;br /&gt;
--xmltxt에서 대표명칭만 뽑아서 보기&lt;br /&gt;
--query 메쏘드는 xpath를 인수로 받음.&lt;br /&gt;
SELECT id, xmltxt.query('/항목/명칭/대표명칭') FROM tour2018s&lt;br /&gt;
SELECT id, xmltxt.query('/항목/명칭') FROM tour2018s&lt;br /&gt;
&lt;br /&gt;
--인명 태그를 모두 뽑기 but query를 쓰면 태그의 위치를 계층적으로 지정해줘야함.&lt;br /&gt;
SELECT id, xmltxt.query('/항목/데이터/해설/문단/건물명') FROM tour2018s&lt;br /&gt;
--계층 상관없이 모든 위치의 요소 뽑기&lt;br /&gt;
SELECT id, xmltxt.query('//인명') FROM tour2018s&lt;br /&gt;
SELECT id, xmltxt.query('//지명') FROM tour2018s&lt;br /&gt;
&lt;br /&gt;
--지명 색인 만들기&lt;br /&gt;
CREATE VIEW tour2018s_place AS&lt;br /&gt;
  SELECT id, node.value('.', 'nchar(80)' ) AS 지명&lt;br /&gt;
  FROM  tour2018s CROSS APPLY xmltxt.nodes('//지명') AS R(node) &lt;br /&gt;
&lt;br /&gt;
SELECT * FROM tour2018s_place&lt;br /&gt;
&lt;br /&gt;
SELECT 지명, count(*) as 빈도&lt;br /&gt;
  FROM  tour2018s_place&lt;br /&gt;
  GROUP BY 지명&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==181206==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use db;&lt;br /&gt;
&lt;br /&gt;
select * from tour2018s&lt;br /&gt;
&lt;br /&gt;
--우리가 하고자 하는것은 2가지&lt;br /&gt;
select xmltxt.query('/항목/명칭/대표명칭') from tour2018s&lt;br /&gt;
select xmltxt.query('/항목/명칭/한자명칭') from tour2018s&lt;br /&gt;
select xmltxt.query('/항목/명칭/영문명칭') from tour2018s&lt;br /&gt;
&lt;br /&gt;
select xmltxt.query('/항목/메타데이터/기본정보/유물형태') from tour2018s&lt;br /&gt;
&lt;br /&gt;
--이런 방식이 불편하므로 별도의 메타데이터를 만드는 것이 필요.&lt;br /&gt;
select xmltxt.value('(/항목/명칭/대표명칭)[1]', 'nchar(80)') from tour2018s&lt;br /&gt;
--.query()는 XML요소를 반환. .value()는 인수로 xpath와 datatype이 필요. 게다가 순서 지정도 필요.&lt;br /&gt;
&lt;br /&gt;
--query로 모든 요소를 검색할 수 있지만, xpath를 쓰는게 불편.&lt;br /&gt;
--따라서 필요한 데이터를 가져와서 별도의 테이블을 만들어둠.&lt;br /&gt;
--별도의 테이블은 항상 연동되어야 함. 따라서 view로 만듦&lt;br /&gt;
&lt;br /&gt;
SELECT&lt;br /&gt;
	xmltxt.query('/항목/명칭/대표명칭'),&lt;br /&gt;
	xmltxt.query('/항목/명칭/한자명칭'),&lt;br /&gt;
	xmltxt.query('/항목/명칭/영문명칭'),&lt;br /&gt;
	xmltxt.query('/항목/메타데이터/기본정보/유물형태'),&lt;br /&gt;
	xmltxt.query('/항목/메타데이터/기본정보/소재지'),&lt;br /&gt;
	xmltxt.query('/항목/메타데이터/기본정보/위도'),&lt;br /&gt;
	xmltxt.query('/항목/메타데이터/기본정보/경도') &lt;br /&gt;
FROM tour2018s&lt;br /&gt;
&lt;br /&gt;
CREATE VIEW tour2018s_meta AS&lt;br /&gt;
SELECT id, &lt;br /&gt;
	xmltxt.value('(/항목/명칭/대표명칭)[1]', 'nchar(40)') AS 대표명칭,&lt;br /&gt;
	xmltxt.value('(/항목/명칭/한자명칭)[1]', 'nchar(40)') AS 한자명칭,&lt;br /&gt;
	xmltxt.value('(/항목/명칭/영문명칭)[1]', 'nchar(80)') AS 영문명칭,&lt;br /&gt;
	xmltxt.value('(/항목/메타데이터/기본정보/유물형태)[1]', 'nchar(40)') AS 유물형태,&lt;br /&gt;
	xmltxt.value('(/항목/메타데이터/기본정보/소재지)[1]', 'nchar(80)') AS 소재지,&lt;br /&gt;
	xmltxt.value('(/항목/메타데이터/기본정보/위도)[1]', 'nchar(20)') AS 위도, &lt;br /&gt;
	xmltxt.value('(/항목/메타데이터/기본정보/경도)[1]', 'nchar(20)') AS 경도 &lt;br /&gt;
FROM tour2018s&lt;br /&gt;
&lt;br /&gt;
select * from tour2018s_meta where 소재지 like '%군산시%'&lt;br /&gt;
select * from tour2018s_meta where 위도 &amp;gt; '36'&lt;br /&gt;
&lt;br /&gt;
select tour2018s.id, 대표명칭, xmltxt from tour2018s_meta join tour2018s &lt;br /&gt;
on tour2018s_meta.id=tour2018s.id &lt;br /&gt;
where 대표명칭 = '곰소염전'&lt;br /&gt;
--id를 별도의 칼럼으로 두는 건 join을 위해서임.&lt;br /&gt;
--xml 테이블을 만들때 id 칼럼을 별도로 만들어 둘 것. &lt;br /&gt;
&lt;br /&gt;
select * from tour2018s &lt;br /&gt;
where xmltxt.value('(/항목/명칭/대표명칭)[1]', 'nchar(40)') = '곰소염전'&lt;br /&gt;
&lt;br /&gt;
--id, 대표명칭, 주소, 위도, 경도&lt;br /&gt;
select id, 대표명칭, 소재지, 위도, 경도 from tour2018s_meta&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==181213==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use s_seonae;&lt;br /&gt;
&lt;br /&gt;
select * from tour2018s_meta&lt;br /&gt;
&lt;br /&gt;
select * from tour2018s&lt;br /&gt;
&lt;br /&gt;
select xmltxt.query('//인명') from tour2018s&lt;br /&gt;
--재귀적 내림 연산자 // recursive descendant operator &lt;br /&gt;
--모든 계층적 태그를 다 살펴본다는 것. &lt;br /&gt;
--xmltxt.nodes('//인명')와 의미적으로 같음.&lt;br /&gt;
--but query는 시각적으로 보여주고(결과테이블) nodes는 보여주지 않음.(메모리에만 저장)&lt;br /&gt;
&lt;br /&gt;
create view tour2018s_person as&lt;br /&gt;
	select id, node.value('.', 'nchar(80)') as 인명&lt;br /&gt;
	from tour2018s cross apply xmltxt.nodes('//인명') as R(node)&lt;br /&gt;
--cross apply : 1건의 레코드를 안에 나오는 갯수만큼 개별 레코드로 따로 저장시키는 것.&lt;br /&gt;
--일종의 join과 비슷. &lt;br /&gt;
--node.value에서 '.'는 그 자체를 의미.(this)&lt;br /&gt;
--R(node) 테이블(컬럼)&lt;br /&gt;
&lt;br /&gt;
select 인명, count(*) as 빈도&lt;br /&gt;
from tour2018s_person group by 인명 order by 빈도 desc;&lt;br /&gt;
&lt;br /&gt;
select * from tour2018s_person&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Seonae</name></author>	</entry>

	</feed>