> For the complete documentation index, see [llms.txt](https://heunnajo.gitbook.io/spring/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://heunnajo.gitbook.io/spring/db/untitled.md).

# H2 DB 설치, 웹콘솔에서 데이터 저장

1. 테이블 생\
   java에서 Long 타입 => sql에서 bigint\
   id : generated by deefault as identity : 값이 없으면(값을 셋팅하지 않고 insert하면) DB에서 자동으로 채워준다.\
   pk는 id로 잡았다.

```sql
drop table if exists member CASCADE;
create table member
(
  id bigint generated by default as identity,
  name varchar(255),
  primary key(id)
);
```

2\. 데이터 넣기(삽입/저장)\
id값을 넣지 않고 값을 넣으면 DB에서 자동으로 생성해준다!

```sql
insert into member(name) values('spring')
insert into member(name) values('spring2')
```

![DB에 값 넣기(저장)](https://3827409906-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdFkJ5hOZX5yyMKQHqf%2F-MdLBUgOJVUS0v4-OhL2%2F-MdLCESolYdVmnUNW_7y%2FH2%20DB%E1%84%8B%E1%85%A6%20%E1%84%80%E1%85%A1%E1%86%B9%20%E1%84%89%E1%85%A1%E1%86%B8%E1%84%8B%E1%85%B5%E1%86%B8.png?alt=media\&token=6c2a65be-4d55-4515-af57-81feb4453514)

![업데이트된 DB](https://3827409906-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdFkJ5hOZX5yyMKQHqf%2F-MdLBUgOJVUS0v4-OhL2%2F-MdLCJhPZKNmti0n4Rey%2FH2%20DB%20%E1%84%80%E1%85%A1%E1%86%B9%20%E1%84%89%E1%85%A1%E1%86%B8%E1%84%8B%E1%85%B5%E1%86%B8%20%E1%84%80%E1%85%A7%E1%86%AF%E1%84%80%E1%85%AA%20%E1%84%8B%E1%85%A5%E1%86%B8%E1%84%83%E1%85%A6%E1%84%8B%E1%85%B5%E1%84%90%E1%85%B3%E1%84%83%E1%85%AC%E1%86%AB%20DB.png?alt=media\&token=87d283c3-a321-4978-b062-ea5a9092dadb)
