---
# System prepended metadata

title: SQL Puzzle mkmk
tags: [Templates, Book]

---

SQL Puzzle mkmk
===

# puzzule 1～5

ここに書いていく
とりあえず、フォーマット自由

## Misato

User story
---

```gherkin=
Feature: Puzzle1
 CREATE TABLE sqlpuzzle.fiscalyeartable1
 (fiscal_year INTEGER,
  start_date  DATE,
  end_date    DATE);


 ALTER TABLE sqlpuzzle.fiscalyeartable1 ADD PRIMARY KEY(fiscal_year);
 
 ALTER TABLE sqlpuzzle.fiscalyeartable1 ADD CONSTRAINT uniq_key UNIQUE(fiscal_year);
 
 ALTER TABLE sqlpuzzle.fiscalyeartable1 DROP CONSTRAINT fiscalyeartable1_pkey;
```

```gherkin=
Feature: Puzzle5
 -- phone_number という型を新たに定義して、制約が 数字２文字から４文字-数字３文字-数字４文字の場合だけ許可
 CREATE DOMAIN sqlpuzzle.phone_number CHAR(13) CHECK( VALUE ~ E'\\d{2,4}-\\d{3}-\\d{4}');
 CREATE TABLE sqlpuzzle.ph ( x sqlpuzzle.phone_number);
 insert into sqlpuzzle.ph values ('11-111-1111');
 insert into sqlpuzzle.ph values ('111-111-1111');
 insert into sqlpuzzle.ph values ('1111-111-1111'); ここでエラー予定だたけどインストールできてしまった・・・
```

## Sakamoto



View the book with "<i class="fa fa-book fa-fw"></i> Book Mode".

Examples
---
- [Book example](/s/book-example)
- [Slide example](/s/slide-example)
- [YAML metadata](/s/yaml-metadata)
- [Features](/s/features)

Themes
---
- [Dark theme](/theme-dark?both)
- [Vertical alignment](/theme-vertical-writing?both)

###### tags: `Templates` `Book`
