데이터베이스 이론과 실습 1주차
SQL(Structured Query Language)
데이터베이스에서 데이터를 처리하는데 사용 되는 언어
사용 이유: SQL을 통하여 데이터베이스를 구축하고, 그 데이터베이스 속 데이터를 추출 및 분석이 가능함
실습1
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
create database Company0829;
create table Department(
DeptNo int not null,
DeptName char(20),
Floor int,
--다른 값을 받음
primary key(DeptNo)
);
Insert into Department Values(1, '영업', 8);
Insert into Department Values(2, '기획', 10);
Insert into Department Values(3, '개발', 9);
Select *
From Department
create table Employee(
Empno int not null,
EmpName char(10),
Title char(10),
Dno int,
Salary int,
primary key(EmpNo)
);
Insert into Employee Values (2106, '김창섭', '대리', 2, 2000000)
Insert into Employee Values (3426, '박영권', '과장', 3, 500000)
Insert into Employee Values (3011, '이수민', '부장', 1, 3000000)
Insert into Employee Values (1003, '조민희', '대리', 1, 2000000)
Insert into Employee Values (3427, '최종철', '사원', 3, 1500000)
Select *
From Employee
1
Output :
실습2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
create database School0829;
use School0829;
create table Student(
Sid int not null,
Sname char(10),
Dep char(10),
Mid int,
Final int,
Addr char(30)
primary key(Sid)
);
Insert into Student Values(20190010, '김창호', 'computer', 98, 90, '서울시 성동구')
Insert into Student Values(20170101, '조민수', 'econ', 89, 94, '서울시 강동구')
Insert into Student Values(20183100, '이수전', 'business', 91, 90, '천안시 동남구')
Insert into Student Values(20201101, '이성준', 'computer', 77, 90, '천안시 동남구')
Insert into Student Values(20211024, '박영철', 'music', 78, 80, '서울시 강남구')
Insert into Student Values(20191003, '최종원', 'computer', 87, 90, '서울시 강북구')
Insert into Student Values(20192136, '김상희', 'music', 80, 85, '서울시 관악구')
Select *
From Student
1
Output :
이 기사는 저작권자의 CC BY 4.0 라이센스를 따릅니다.