Skip to content

Commit

Permalink
Update markdown languages
Browse files Browse the repository at this point in the history
  • Loading branch information
peferron committed Nov 29, 2016
1 parent 3f287fc commit 87d5968
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
24 changes: 12 additions & 12 deletions postgres/homework.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

### 1.

```
```SQL
SELECT relname FROM pg_class
WHERE relname !~ '^(pg_|sql_)'
AND relkind = 'r';
```

### 2.

```
```SQL
SELECT c.country_name FROM countries c
JOIN venues v ON c.country_code = v.country_code
JOIN events e ON v.venue_id = e.venue_id
Expand All @@ -21,7 +21,7 @@ WHERE e.title = 'LARP Club';

### 3.

```
```SQL
ALTER TABLE venues
ADD COLUMN active BOOLEAN DEFAULT TRUE;
```
Expand All @@ -30,15 +30,15 @@ ADD COLUMN active BOOLEAN DEFAULT TRUE;

### 1.

```
```SQL
CREATE RULE delete_venue
AS ON DELETE TO venues DO INSTEAD
UPDATE venues SET active = false WHERE venue_id = OLD.venue_id;
```

### 2.

```
```SQL
SELECT * FROM generate_series(1, 12);
```

Expand Down Expand Up @@ -97,7 +97,7 @@ This exercise is fairly difficult. Here are the steps I followed.

3. So we need to start by listing all the days in the month (we'll pick February 2012 since it has the most events):

```
```SQL
SELECT date
FROM generate_series(
'2012-02-01'::date,
Expand Down Expand Up @@ -142,7 +142,7 @@ This exercise is fairly difficult. Here are the steps I followed.

2. Then join with the events table:

```
```SQL
SELECT date, title
FROM (
SELECT date
Expand Down Expand Up @@ -193,7 +193,7 @@ This exercise is fairly difficult. Here are the steps I followed.

3. Show the count instead of the title:

```
```SQL
SELECT date, NullIf(count(events), 0) AS count
FROM (
SELECT date
Expand Down Expand Up @@ -245,7 +245,7 @@ This exercise is fairly difficult. Here are the steps I followed.

4. Show the week of month and day of week instead of the date:

```
```SQL
SELECT
extract(week from date) - extract(week from date_trunc('month', date)) AS wom,
extract(dow from date) AS dow,
Expand Down Expand Up @@ -300,7 +300,7 @@ This exercise is fairly difficult. Here are the steps I followed.

5. We're now ready for the `crosstab`:

```
```SQL
SELECT * from crosstab(
'SELECT
extract(week from date) - extract(week from date_trunc(''month'', date)) AS wom,
Expand Down Expand Up @@ -343,7 +343,7 @@ This exercise is fairly difficult. Here are the steps I followed.

### 1.

```
```SQL
CREATE OR REPLACE FUNCTION suggestion(input text)
RETURNS SETOF text as $$
BEGIN
Expand Down Expand Up @@ -372,7 +372,7 @@ $$ LANGUAGE plpgsql;

Ignored the last-name-only requirement. Splitting full names into first and last names is not reliable anyway.

```
```SQL
CREATE TABLE comments (comment text);

INSERT INTO comments (comment) VALUES
Expand Down
12 changes: 6 additions & 6 deletions riak/homework.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@

### 1.

```
```bash
curl -X PUT "http:https://localhost:10038/riak/animals/polly" \
-H "Link: </riak/photos/polly.jpg>; riaktag=\"photo\"" \
-d '{"nickname": "Sweet Polly Purebred", "breed": "Purebred"}'
```

### 2.

```
```bash
curl -X PUT "http:https://localhost:10038/riak/cats/takkun.svg" \
-H "Content-Type: image/svg+xml" \
--data-binary @takkun.svg
```

### 3.

```
```bash
curl -X PUT "http:https://localhost:10038/riak/medicines/antibiotics" \
-H "Content-Type: image/jpeg" \
-H "Link: </riak/animals/ace>; riaktag=\"treats\"" \
Expand All @@ -31,7 +31,7 @@ curl -X PUT "http:https://localhost:10038/riak/medicines/antibiotics" \

### 1.

```
```bash
curl -X POST "http:https://localhost:10018/mapred" \
-H "content-type:application/json" \
--data @-
Expand Down Expand Up @@ -70,7 +70,7 @@ curl -X POST "http:https://localhost:10018/mapred" \

### 2.

```
```bash
curl -X POST "http:https://localhost:10018/mapred" \
-H "content-type:application/json" \
--data @-
Expand Down Expand Up @@ -116,7 +116,7 @@ curl -X POST "http:https://localhost:10018/mapred" \

Insert an animal with a score of 3:

```
```bash
curl -X PUT "http:https://localhost:10038/riak/animals/ace" \
-H "Content-Type: application/json" \
-H "x-riak-index-score_int: 3" \
Expand Down

0 comments on commit 87d5968

Please sign in to comment.